• I have my own custom add-to-cart button which uses AJAX to add multiple products to cart at once.

    here’s my code excerpt:

    
    $('.my-add-to-cart-button').click(function(e){
      e.preventDefault();
      $.ajax({
            type: 'get',
            url: '/my-wordpress-directory/',
            dataType: 'html',
            data: {'add-to-cart': {product_id}, 'quantity' : {quantity}},
          })
      .done(function(){
        // some function to show successfully added.
      });
    });
    

    But when I click add-to-cart-button several times then manually go to cart page,
    ‘n x Some products are successfully added. show cart’ message was repeated as much as I clicked.

    I guess some scripts keep the information of which product gets added, dump all the message on cart page at same time.

    I would like to know how to flush all messages before I go to cart page.

    • This topic was modified 8 years, 3 months ago by twotae.
  • The topic ‘Added to cart messages or error messages are stacked.’ is closed to new replies.