Aleš Sýkora / September 20, 2022 / 0 comments

Global $product cause Oxygen does not refresh CSS

Post summary: The issue is related to the custom PHP functions being used the Repeaters in WooCommerce templates. Within the custom functions, after you call global $product, you need to wrap the rest of the function in an if($product) { …do stuff here } statement. This will prevent the AJAX errors. Also do not use Global $product…

The issue is related to the custom PHP functions being used the Repeaters in WooCommerce templates. Within the custom functions, after you call global $product, you need to wrap the rest of the function in an if($product) { …do stuff here } statement. This will prevent the AJAX errors.

global $product;
if($product) { ...do stuff here }

Also do not use Global $product on single product template. Instead use:

$product = wc_get_product( get_the_ID() ); 

Fuel my passion for writing with a beer🍺

Your support not only makes me drunk but also greatly motivates me to continue creating content that helps. Cheers to more discoveries and shared success. 🍻

0 comments

Share Your Thoughts