使用BigCommerce模具将商品添加到购物车 [英] Adding item to cart with BigCommerce Stencil

查看:115
本文介绍了使用BigCommerce模具将商品添加到购物车的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题特定于BigCommerce模具.是否可以在产品上下文之外使用'cart-item-add'钩子?

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.

推荐答案

我能够使用utils.api.cart.itemAdd()

I was able to get it working with utils.api.cart.itemAdd()

问题是我添加到购物车表单操作.在产品卡中,我需要使用{{add_to_cart_url}}"而不是{{product.cart_url}}

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}}

这篇关于使用BigCommerce模具将商品添加到购物车的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆