• 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

    • This topic was modified 4 days, 23 hours ago by krjojo.
Viewing 1 replies (of 1 total)
  • Plugin Support LovingBro (woo-hc)

    (@lovingbro)

    Hi @krjojo,

    I understand you’re encountering an issue where Chinese attribute names aren’t being processed correctly with WC_Product_Variation(), resulting in “any color” and “any size” showing on the final product editing page.

    To help diagnose this, could you please share more details about the error? Specifically, it would be helpful to know:
    – On which site is this happening?
    – What steps did you take that led to this error?
    – Could you attach a screenshot of the issue, ensuring that the full page (including the browser address bar) is visible?

    Additionally, could you share your System Status Report? You can find this by going to WooCommerce > Status > Get Status > Copy for Support, then share it via https://pastebin.com/ or https://gist.github.com/.

    This additional information will assist us in identifying the cause and working towards a solution. Looking forward to your response.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.