Add to cart button loading items to cart very very very slow or not at all
-
Good day
I have had an issue with my woodmart child theme since the last update. Very frustrating as my site has been unusable for a long time, clients cannot add products to the cart so who knows how many sales have been lost while I track contact with anyone who can assist me. Really really frustrating.
Please could someone from tech support assist me ASAP
Regards
Hello,
Try to add the following PHP code snippet to the child theme functions.php file to fix this
add_filter('woocommerce_add_to_cart_redirect', function( $url ) {
if( strpos( $url, 'product-added-to-cart' ) > 0 || strpos( $url, 'product_added_to_cart' ) > 0) {
if ( isset( $_REQUEST['wd-add-to-cart'] ) ) {
return wc_get_checkout_url();
}
return '';
}
return $url;
}, PHP_INT_MAX);
Kind Regards
OK thanks we will try
Also the homepage is loading very slowly since the update. The other pages are fine but the homepage is loading very slowly
Will this be resolved with teh next theme update so we can remove the code
Hello,
The add to cart problem is caused by one of the installed plugins. So you need to keep the code even after the update.
As for the home page, please, check how it works with the default WordPress theme to see if it is caused by WoodMart or not.
Thank you in advance.