URGENT – Add to cart button is broken on my store
-
When my site updated to the latest version my customers started complaining the site was slow and did not work right.. turns out the add to cart button is not working as it should on the product page. it seems to work from the archive list but not from the product page.
In the screen shot you can see how the add to cart button is stuck in buffering. But it never reloaded the page to display the message that the item has been added to the cart. once you reload the page, or go to another page, the message will show up and the item will be added to the cart,
Attachments:
You must be
logged in to view attached files.
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
Thanks for your quick response. Great work!
Now the shopping cart slides open instead of waiting on a broken button.
Sorry, but we don’t quite understand what is wrong now. Could you please send a screenshot?
I was saying it fixed the broken add to cart button, it now opens the cart instead of spinning forever, Thanks you
Oh, great. In this case, we close this topic. Feel free to contact us if you have any further questions.
The topic ‘URGENT – Add to cart button is broken on my store’ is closed to new replies.