Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Always trigger global listeners - add Shopify.onItemAdded & Shopify.onCa... #260

Closed
wants to merge 2 commits into from

Conversation

humancopy
Copy link
Contributor

Hey ...

It's important to have these general listeners trigger to be able to easily customize the AJAX cart. The settings.onToggleCallback is not enough as it's called before the AJAX completes and can't be used to manipulate the cart. Currently to resolve this we have defined global AJAX listeners which check the request's URL to determine which action is happening (cart.js, add.js etc...)

With these cart listeners it will be much easier to add a loader, apply currency formatting or any other cart customization required.

I also added a default Shopify.onItemAdded and a new method Shopify.onCartOpen which is called after the AJAX request to open the cart completes.

Thanks :)

@humancopy
Copy link
Contributor Author

It got all mixed up when I merged latest master with the fork ... Let me know if you're interested in this change and I'll make a new pull :)

@humancopy humancopy closed this Nov 12, 2014
@cshold
Copy link
Contributor

cshold commented Nov 12, 2014

I have an issue open for the callback firing before it should.

#244

It'll fix the issue you're seeing, and avoid any confusion trying to custom set callbacks. Shopify.getCart for example, doesn't always mean the cart is open so calling Shopify.onCartOpen doesn't necessarily make sense. Keep an eye on the issue above and we should get to a solid solution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants