WC-Product_ariation() cannot correctly input Chinese attrib
-
When the product attribute name is in Chinese, the product variant cannot be entered correctly.
$attributes_data = ['颜色'=>'红色','尺码'=>'S'];
$variation = new WC_Product_Variation();
$variation->set_parent_id($product_id);
$variation->set_attributes($attributes_data);
$variation->set_regular_price($price);
$variation->set_stock_quantity($stock);
$variation->set_manage_stock(true);
$variation->save();In the final product editing page, “any color” and “any size” will be displayed.
But if switching back to English attributes, such as: color 、size, It will display 红色 and S normally
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.