Skip to content

'edd_quantity_updated' should trigger when add item to cart #8080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
akshuvo opened this issue Aug 9, 2020 · 0 comments · May be fixed by #8081
Open

'edd_quantity_updated' should trigger when add item to cart #8080

akshuvo opened this issue Aug 9, 2020 · 0 comments · May be fixed by #8081

Comments

@akshuvo
Copy link
Contributor

akshuvo commented Aug 9, 2020

Bug Report

Expected behavior

When I add any item to cart I expect this should be triggered $(document.body).trigger('edd_quantity_updated', [ response.cart_quantity ]);

Actual behavior

When I add item to cart this $(document.body).trigger('edd_quantity_updated', [ response.cart_quantity ]); not trigger when there is no span.edd-cart-quantity DOM because of this code:

$('span.edd-cart-quantity').each(function() {
	$(this).text(response.cart_quantity);
	$(document.body).trigger('edd_quantity_updated', [ response.cart_quantity ]);
});

Steps to reproduce the behavior

  1. $(document.body).trigger('edd_quantity_updated', [ response.cart_quantity ]); should be out from $('span.edd-cart-quantity').each(function() {});
  2. So the code would be:
$('span.edd-cart-quantity').each(function() {
	$(this).text(response.cart_quantity);	
});
$(document.body).trigger('edd_quantity_updated', [ response.cart_quantity ]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant