Closed Ulprus closed 2 years ago
Hello @Ulprus,
This was an issue that should have been fixed in Oxygen 4.0.4 when PHP such as global $product
is used in a Code Block element.
I wasn't able to see the issue on the Sandbox site, but when using an external script, you may want to wrap the code within an if statement to see if that fixes the issue:
<?php
/* This function breaks Oxygen's 'Regenerate CSS' for some reason */
function u_product_sku()
{
global $product;
if($product) {
$productSKU = $product->get_sku();
echo $productSKU;
}
}
Hi @Kpudlo - apologies for the delayed response; email never went into my primary inbox.
That worked perfectly! Thanks so much. Really appreciate this.
Describe the bug When setting up a PHP function in a snippet program (IE, Advanced Scripts) which echoes or returns a Product Class of WooCommerce (example:
$product->get_sku();
), whichever page or template uses this PHP Function will cause an AJAX error when regenerating that page's/template's CSS cache.A link to a Sandbox site where the bug has been reproduced https://oxygenbuilder.com/try? (REQUIRED) Link: Admin Login Username: TestUser Password: TestUserPass123!@#
IF YOU CAN'T PROVIDE A SANDBOX REPRODUCTION: Steps required to reproduce the bug: Steps to reproduce the behavior:
product
u_product_sku