WPML
Status
Resolved
Resolved in
4.12.0

Overview of the issue

After translating a product, sometimes product variations in the default language are no longer visible on the front-end.

The reason for this is that the transient of the variation is stored in the translated language code instead of the default language code. WooCommerce Variable product children transient can be sometimes populated with wrong values if it’s computed on-page in a different language.

Unfortunately, we could not identify in which context this is happening.

Workaround

Until we have better information of the context, we suggest adding the following snippet to your theme’s functions.php file:

/**
 * Prevent issues with product variations transient when it's
 * computed in a secondary language page for a product in
 * the default language.
 */
add_filter( 'woocommerce_variable_children_args', function( $args ) {
	global $sitepress;
	$parseQueryAction = [ $sitepress, 'parse_query' ];
	if ( remove_action( 'parse_query',  $parseQueryAction ) ) {
		add_action( 'setted_transient', function() use ( $parseQueryAction ) {
			add_action( 'parse_query',  $parseQueryAction );
		} );
	}
	return $args;
} );

All known issues →