Skip to content

Instantly share code, notes, and snippets.

@puzzfuzz
Last active January 29, 2018 23:25
Show Gist options
  • Save puzzfuzz/a6af55e69ec733dfbbd90201d9494bdb to your computer and use it in GitHub Desktop.
Save puzzfuzz/a6af55e69ec733dfbbd90201d9494bdb to your computer and use it in GitHub Desktop.
// Rigging.js
class Rigging {
/* ... */
cartUpdated = (newCart) => {
this.dispatch(cartActions.cartUpdated(newCart));
};
}
// templates/product.liquid
$('#AddToCartBtn').on('click', function() {
ShopifyAPI.addItemToCart({{ product.handle }})
.then(function(newCart) {
// Call Rigging directly from a window-level event to dispatch data
// into the Redux store
window.Rigging.cartUpdated(newCart);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment