fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

woo-variation-swatches fatal error latest version

HI, Im receiving this error

[30-Nov-2022 17:52:19 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_parent_id() on bool in /home/customer/www/loborosa.com/public_html/wp-content/plugins/woo-variation-swatches/includes/class-woo-variation-swatches-manage-cache.php:148
Stack trace:
#0 /home/customer/www/loborosa.com/public_html/wp-includes/class-wp-hook.php(308): Woo_Variation_Swatches_Manage_Cache->clear_cache_on_product_modify(19374)
#1 /home/customer/www/loborosa.com/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(”, Array)
#2 /home/customer/www/loborosa.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 /home/customer/www/loborosa.com/public_html/wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php(303): do_action(‘woocommerce_del…’, 19374)
#4 /home/customer/www/loborosa.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-data-store.php(207): WC_Product_Data_Store_CPT->delete(Object(WC_Product_Variation), Array)
#5 /home/customer/www/loborosa.com/public_html/wp-con in /home/customer/www/loborosa.com/public_html/wp-content/plugins/woo-variation-swatches/includes/class-woo-variation-swatches-manage-cache.php on line 148

I checked with the plugin health and troubleshooting:

theme:hello elementor
plugins: woocommerce, Variation Swatches for WooCommerce  and Variation Swatches for WooCommerce – Pro

 

and still not working , showing that error

 

 

 

Rezwan Shiblu

Hi Nicolas,

Thanks for reaching out to us. Sorry for your inconvenience.

Please add the below snippet using the Code Snippets Plugin:

add_action('woo_variation_swatches_manage_cache_loaded', function( $woo_variation_swatches_manage_cache_loaded ){ remove_action( 'woocommerce_save_product_variation', array( $woo_variation_swatches_manage_cache_loaded, 'clear_cache_on_product_modify' ) ); remove_action( 'woocommerce_update_product_variation', array( $woo_variation_swatches_manage_cache_loaded, 'clear_cache_on_product_modify' ) ); remove_action( 'woocommerce_delete_product_variation', array( $woo_variation_swatches_manage_cache_loaded, 'clear_cache_on_product_modify' ) ); remove_action( 'woocommerce_trash_product_variation', array( $woo_variation_swatches_manage_cache_loaded, 'clear_cache_on_product_modify' ) ); }, 10, 1);

Let me know if it resolves your issue or not.

We are working on a new version. Please remove the above snippet after updating the next version.

Thank You