Miguel Carneiro
Forum Replies Created
-
upgrade your plugin and now works fine .
thanks for your work 🙂The error occurs only when we edit a custom template or single product template
if u need more details please share
thanks 🙂- This reply was modified 1 year, 3 months ago by Miguel Carneiro.
hello friend
you can tru breakdance page builder here: https://breakdance.com/try/
I change this for teste proposes and works very goodWhen using the “video-wc-gallery” plugin alongside the Breakdance page builder, the following fatal error occurs:
Fatal error: Uncaught Error: Call to a member function is_type() on string in /wp-content/plugins/video-wc-gallery/functions/do.php on line 337Root Cause
In the
vwg_add_custom_style_and_scripts_product_page()function (functions/do.php, line 337), the code attempts to call:$product->is_type('variable');However, when used with the Breakdance page builder, the global
$productvariable is sometimes initialized as a string instead of a WooCommerce product object, leading to the fatal error.SolutionTo ensure compatibility with Breakdance and other page builders that may alter the WooCommerce product object initialization, implement the following fix:
function vwg_add_custom_style_and_scripts_product_page() { if (is_product()) { global $product; // Ensure $product is a valid object and initialize if necessary if (!is_object($product)) { $product = wc_get_product(get_the_ID()); } // Verify that we now have a valid product object if (!is_object($product)) { return; // Exit the function if $product is still not valid } // Continue with the rest of the function... } }Summary
This fix provides a fallback mechanism to correctly initialize the
$productobject, preventing fatal errors and improving compatibility with Breakdance and similar page builders.