Closed Proxes-888 closed 3 years ago
Hi, I am not quite clear which problem you are describing - are you managing stock separately in different languages? You say "The product re-appears only in the primary language - not in the secondary language." What is the stock level in the secondary language and what are you expecting it to be? Check that stock synchronisation is turned on in woopoly Features and Metas, see https://github.com/hyyan/woo-poly-integration/wiki/Stock and related pages on the wiki
Hi Jon, The stock synchronization is turned on. In the table wp_term_relationships the term outofstock is not cleared for the secondary language, when the stock quantity is changed from 0 to a positive number. It is cleared only for the primary language. Both products in the both languages show the same stock quantities in the backend. The quantity for the second language is not editable. The setting "Hide out of stock products" is checked in woocommerce, and the product in the second language does never reappear in the store. It appears, only if I manually clear the outofstock from the wp_term_relationships table.
ok this is reproduced with WooCommerce 4. the product comes back in stock but as you say does not appear in the catalogue pages. I was expecting this to be a cache issue or issue with the newish table eg wp_wc_product_meta_lookup but this seems updated successfully to instock on the translations once stock is restored. However as you say product_visibility is not synchronised and [only if Hide out of stock products is selected] will remain set to exclude-from-catalog, exclude-from-search and outofstock
when stock is managed at variation level, it appears that after a sale wp_postmeta _stock_status is set to outofstock even when stock has not yet reached zero. It then shows Out of stock in the admin products list at /wp-admin/edit.php?post_type=product and disappears from the catalogue although the product itself, if viewed, appears in stock and purchasable. wp_wc_product_meta_lookup and wp_postmeta are both out of sync between languages
options:
also possible bug: if stock is managed at the variation level, SyncStock uses
Variation::getRelatedVariation( get_post_meta( $product_with_stock->get_id()
, Variation::DUPLICATE_KEY, true )
That relies on the _point_to_variation meta linking secondary languages to the base language so should only work if the $product_with_stock is in the shop base language.
Can you reproduce this issue on default Wordpress theme (eg Storefront)?
Yes
Can you reproduce this issue when all other plugins are disabled except WooCommerce, Polylang and Hyyan WooCommerce Polylang Integration?
Yes
What product versions and settings are you using when this issue occurs?
Steps to Reproduce
Add a product with some stock quantity e.g. 5, save the product, create a second product for the secondary language. Later, set the stock quantity to 0 for the primary language, update the product, and set the stock for that product again to 5. The product re-appears only in the primary language - not in the secondary language.
What I Expected
I expect after changing the quantity of the product from 0 to positive number to make products in both languages appear in store.
What Happened Instead
Only product in primary language appeared
WordPress Environment