问题
This question is specific to BigCommerce Stencil. Is it possible to use 'cart-item-add' hook outside of product context?
Right now when user adds product from 'product card' they get sent to cart. I'd like to change that behaviour.
回答1:
I was able to get it working with utils.api.cart.itemAdd()
The issue was my add to cart form action. In the product card I needed to use {{add_to_cart_url}}"
instead of {{product.cart_url}}
来源:https://stackoverflow.com/questions/35165847/adding-item-to-cart-with-bigcommerce-stencil