Update woocommerce Cart with ajax - ajax

Am using the following shortcode for displaying the cart
[woocommerce_cart]
And also am using https://wordpress.org/support/plugin/woocommerce-ajax-cart plugin. When there is no products and am clicking on the button to see the Cart items it shows that the cart is empty but when am refreshing the page am getting that added product.
When i already have one product in the cart it is refreshed by ajax but when no products it did not work.
Any idea why?
Thanks in advance.

Related

Woocommerce Cart AJAX not working when cart is loaded with shortcode

I am using [woocommerce_cart] shortcode to load Cart in hidden absolute full-overlay div which can be opened on any page (it's located in header).
The problem: Cart AJAX is not working on any other page except mywebsite.com/cart page.
For example, when I am on my home page, I open my absolute full-overlay div which contains Shopping Cart called by shortcode, and I click on Update Cart button, it does update the cart, but instead of doing it with AJAX, it redirects me to mywebsite.com/cart page.
I figured out how to prevent redirection to /cart page by following this instructions: WooCommerce: updating cart from checkout page redirects to cart page , but it still reloads the current page instead of using AJAX.
So, the main thing I would like to achieve is to force Cart AJAX on all pages. However, it would also be helpful if someone knows how to prevent redirections after click on Update Cart, Remove Item... BUT only redirections, and let the processes of updating cart, removing items etc. to be completed (so preventDefault() is not an option.)
Thanks.

Shopify add to cart ajax update cart on button click - Update the cart note and the entire cart drawer

I am working on a shopify site where I have created a hover over option for quick shop. When the item is added to the cart I need the cart number to update and the cart drawer to update. However, this is not working! Can someone help?
You could use something like:
jQuery.getJSON('/cart.js', function(cart) {
$('#CartCount').text(cart.item_count)
});
Where #CartCount is your counter. For the dropdown cart itself, I believe you'd have to rebuild the cart yourself via the cart.js response.

Ajax Cart empty Prestashop 1.6

In prestashop 1.6
Using Ajax-cart
If i log-in as a Customer and add products to the cart and checkout the order all work.
Then the ajax cart stop working.
If I add a product to the cart and refresh the page the cart return
empty.
If i add a product to the cart and click "go to cart" the cart return empty.
If i log out and log in again, the cart return working for an order, then if i checkout the new order the problem return.
seem to be a problem whith Cookie the is overwritter in some ajax call in ajax-cart.js
I've look this but is not my case :Cart products dissapear on refresh page Prestashop
If i disable ajax cart all work fine.
EDIT
On Google i've found something and seem to be an ajax problem but all the solution suggested don't work.
I was also facing the same issue. You should try the following module and try last two options from the module's configuration and this issue will be gone:
https://github.com/PrestaShop/pscleaner
IMPORTANT: If you are trying it on live site make sure you do not enable first options in this module i.e. Clean up Customers, Clean up Catalog & Orders.
Reply back if you still face the issue.
Cheers!!

Magento Shopper Theme add to cart not working

I'm using the Magento Shopper Theme (http://shopper.queldorei.com/).
When I add a product to cart, cart doesn't update and show the products added to cart. But if I refresh the page, then it shows the products added in the cart.
Does anybody have an idea of what to do to fix this?
This is your problem. Use chromes debugger to debug ajax requests. Also, you are including jquery but it doesn't exist at the URL specified.
Please Check you have included more that 1 jquery files .

Magento: Clicking on add to cart open a order form. After submitting form redirect to add to cart page

I am working on one magento site. What client need after clicking on Add To Cart button a prescription form will be opened.
After filling prescription form it redirect to Add to cart page. On Cart page product listing prescription that user added should be display with product.
Can anyone guide me how to achieve this?
1) Switch the addtocart url with a javascript pop-up that opens.
2) Do the addtocart using ajax.
3) Show form in pop-up
4) When filled in do ajax post to controller that saves the items to the quote-item (setData).
5) Redirect to cart when this succeeds
6) Display custom data in the renderer using getData.
I guess this flow will put you in the right direction?

Resources