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

Fatal Error with v2.0.13

Dave Spohn

I started seeing this fatal error since v2.0.13 (I updated my plugin November 17/22).

My scenario:

I went in to an existing variable product. I had to add a new variation and remove one variation that I added in error. I started with “Medium”, “Large”, “X-Large” and then went and added “Small” and “2X”. I had to then remove the “2X” variant. I hit save in the variable screen and then hit save for the main product. I was then presented with a nice white screen telling me my site has experienced a fatal error. This is the second time I have had this happen. Luckily, the site is still operational (admin section and live site). I just hit my back button and I can continue editing my product. I do reuse “old” products (some with variants and some single products). This behavior was not present in past versions of your plugin.
****I do not know if your plugin will throw an error on a new product. I haven’t had to create one that uses swatches yet. I can verify it does not like working with an existing product (with variants), if a variant is added or removed.

 

**Sorry, for the time being, I am not giving access to my live site and hope you can understand my wish.

 

2022-12-04T17:07:05+00:00 CRITICAL Uncaught Error: Call to a member function get_parent_id() on bool in /home/kissmyl/public_html/wp-content/plugins/woo-variation-swatches/includes/class-woo-variation-swatches-manage-cache.php:148
Stack trace:
#0 /home/kissmyl/public_html/wp-includes/class-wp-hook.php(307): Woo_Variation_Swatches_Manage_Cache->clear_cache_on_product_modify(65553)
#1 /home/kissmyl/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
#2 /home/kissmyl/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#3 /home/kissmyl/public_html/wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php(303): do_action('woocommerce_del...', 65553)
#4 /home/kissmyl/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/kissmyl/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php(199): WC_Data_Store->delete(Object(WC_Product_V in /home/kissmyl/public_html/wp-content/plugins/woo-variation-swatches/includes/class-woo-variation-swatches-manage-cache.php on line 148

2022-12-04T17:13:14+00:00 CRITICAL Uncaught Error: Call to a member function get_parent_id() on bool in /home/kissmyl/public_html/wp-content/plugins/woo-variation-swatches/includes/class-woo-variation-swatches-manage-cache.php:148
Stack trace:
#0 /home/kissmyl/public_html/wp-includes/class-wp-hook.php(307): Woo_Variation_Swatches_Manage_Cache->clear_cache_on_product_modify(65556)
#1 /home/kissmyl/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
#2 /home/kissmyl/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#3 /home/kissmyl/public_html/wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php(676): do_action('woocommerce_del...', 65556)
#4 /home/kissmyl/public_html/wp-content/plugins/woocommerce/includes/class-wc-data-store.php(224): WC_Product_Variable_Data_Store_CPT->delete_variations(65555, true)
#5 /home/kissmyl/public_html/wp-content/plugins/woocommerce/includes/class-wc-post-data.php(150): WC_Data_Store->__call('delete_variatio...',  in /home/kissmyl/public_html/wp-content/plugins/woo-variation-swatches/includes/class-woo-variation-swatches-manage-cache.php on line 148

Rezwan Shiblu

Hi Dave,

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);

Then try again and let me know if it resolves your issue or not.

Thank You