Home Forums WoodMart support forum URGENT – Add to cart button is broken on my store

URGENT – Add to cart button is broken on my store

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #447462

    mrt333
    Participant

    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.
    #447616

    Artem Temos
    Keymaster

    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

    #447740

    mrt333
    Participant

    Thanks for your quick response. Great work!

    Now the shopping cart slides open instead of waiting on a broken button.

    #447743

    Artem Temos
    Keymaster

    Sorry, but we don’t quite understand what is wrong now. Could you please send a screenshot?

    #447770

    mrt333
    Participant

    I was saying it fixed the broken add to cart button, it now opens the cart instead of spinning forever, Thanks you

    #447793

    Artem Temos
    Keymaster

    Oh, great. In this case, we close this topic. Feel free to contact us if you have any further questions.

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘URGENT – Add to cart button is broken on my store’ is closed to new replies.