Support » Plugin: WooCommerce Multilingual - run WooCommerce with WPML » Disappearing product variations – possible cause found

  • alexanderaltendorfer

    (@alexanderaltendorfer)


    We are having troubles with disappearing product variations on the front end from time to time. There are some support entries on this topic, but none of the usual debugging steps permanently resolved our issue. So I started to dig into the code and I found out, that WooCommerce stores product variations in a transient wc_product_children_{parent_id}. The transient is created in class-wc-product-variable-data-store-cpt.php in the read_children() function.
    It appears, that sometimes this function is called in the wrong language and therefore the wrong product variations are stored in the transient. In our case, the transient for the German parent product contained the IDs of the English variations.
    A possible solution for this would be to hook into woocommerce_variable_children_args and make sure that the transient is saved with the correct language.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author strategio

    (@strategio)

    Hi @alexanderaltendorfer,

    Thanks for reporting this!

    I had a look at \WC_Product_Variable_Data_Store_CPT::read_children as you suggested. But honestly, this does not give me any hint right now. get_post is possibly filtering the parent ID at some point and I don’t see how filtering the arguments will help (the product ID should be initially correct).

    You might also consider checking the suppress_filters argument. It should be true by default, but if some 3rd part plugin is changing it, it could have side effects.

    Your issue might not be easy to fix because it’s hard to reproduce, but my suggestion is to open a ticket on the wpml.org support forum. There you can safely share information/settings about your site and it will help troubleshoot further. If you can share a minimal setup where you manage to see this issue from time to time, it would be great (if you can provide steps, it’s even better)

    You can share the wpml.org forum link if you wish, so we can follow.

    Thanks,
    Pierre

    Thread Starter alexanderaltendorfer

    (@alexanderaltendorfer)

    Thank you for your reply. I created a new ticket at https://wpml.org/forums/topic/wcml-disappearing-product-variations/ and provided some more details on how to reproduce the issue.

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