Support » Plugin: WooCommerce » Cart is showing empty after adding an item with AJAX

  • Hi,

    I have Add to Cart button with Ajax and when clicking on it it add the item and shows the Cart items Number as 1 but when i want to see that in cart section which i displayed using the following shortcode

    <?php echo do_shortcode('[woocommerce_cart]');?>

    I see Your cart is currently empty. message. But when i refresh the page and then clicking on the buutton which is showing the Cart items(how i told above am getting the cart output with the shortcode) i see the output.

    Any idea how i can fix this?

    Thanks in advance.

    https://wordpress.org/plugins/woocommerce/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Mike Jolley

    (@mikejolley)

    The shortcode does not refresh itself, so you need to either reload the page contents with more ajax requests, or trigger page refresh after adding to cart.

    I don’t need the page refresh.

    What exactly i need to update so it will be refreshed with Ajax after adding product to cart?

    Am using Woo AJAX Cart Plugin but it works only when i already have one product added but when 0 no it did not show the added product.

    Thanks in advance.

    Plugin Author Mike Jolley

    (@mikejolley)

    Not familiar with Woo AJAX Cart

    Are you aware 2.6 is going to have an ajax cart built in?

    Yes that will be very good as ajax calls are userfriendly as they don’t need to refresh the page!

    So you can’t help me with some info about how to update cart with ajax from first please?

    Thanks in advance.

    Plugin Author Mike Jolley

    (@mikejolley)

    jquery ‘load’ function.

    ok i will use .load fnction but inside the load funvtion what else i need to add?

    thanks in advance.

    Plugin Author Mike Jolley

    (@mikejolley)

    Just reload the cart page and replace the cart content area.

    i cant reload the page as how i told you i have the cart data in popup.

    Or you mean something else by saying reload?

    thanks

    Plugin Author Mike Jolley

    (@mikejolley)

    *sigh. Look at the docs for jquery load function 🙂 You can ‘load’ a page and get content from within it.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Cart is showing empty after adding an item with AJAX’ is closed to new replies.