Hello,
Thank you for the information! In order to better investigate the issue and provide a fix, I will need the Breakdance plugin to install it on my local environment. Please provide the download link for the plugin and send it via email.
Thank you in advance, and I look forward to your cooperation!
hello friend
you can tru breakdance page builder here: https://breakdance.com/try/
I change this for teste proposes and works very good
When 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 337
Root 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 $product variable is sometimes initialized as a string instead of a WooCommerce product object, leading to the fatal error.Solution
To 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 $product object, preventing fatal errors and improving compatibility with Breakdance and similar page builders.
I have installed the plugin but was unable to reproduce the issue, most likely because I am not fully familiar with how it works. However, I have reviewed the fix you provided, and it looks good to me. I also tested it to ensure that it does not break anything in the plugin, and everything seems fine.
For this reason, I have released the fix in version 1.37. Please update to the latest version, and let me know if the issue is resolved.
Looking forward to your feedback!
The error occurs only when we edit a custom template or single product template
if u need more details please share
thanks 🙂
upgrade your plugin and now works fine .
thanks for your work 🙂
I’m glad we were able to resolve the issue! 😊 If you have a moment, it would mean a lot if you could leave a review for the plugin https://ww.wp.xz.cn/support/plugin/video-wc-gallery/reviews/?filter=5. It really helps with its development.
Also, if you’d like, you can support the plugin through the links available in the plugin itself.
Thanks again for your feedback and support! 🚀