我已实施' Shpoify Buy Button'在Symfony项目中。我想限制添加更多数量到购物车。
以下是我的json代码' Shpoify Buy Button':
Shopify.render('shopify-btn', {{ current_program.shopifyId|json_encode|raw }}, {
"product": {
"buttonDestination": "checkout",
"variantId": "all",
"contents": {
"img": false,
"imgWithCarousel": false,
"title": false,
"variantTitle": false,
"price": false,
"description": false,
"buttonWithQuantity": false,
"quantity": false
},
"text": {
"button": "BUY NOW"
},
"styles": {
"product": {
"@media (min-width: 601px)": {
"max-width": "100%",
"margin-left": "0",
"margin-bottom": "50px"
}
},
"button": {
"background-color": "#3771c8",
"font-size": "18px",
"font-weight": "bold",
"height": "61px",
":hover": {
"background-color": "#3266b4"
},
":focus": {
"background-color": "#3266b4"
}
},
"title": {
"font-size": "26px"
},
"price": {
"font-size": "18px"
},
"compareAt": {
"font-size": "15px"
}
}
},
"cart": {
"contents": {
"button": false,
"quantity": false
},
"text": {
"total": "Total"
},
"popup":false,
"styles": {
"button": {
"background-color": "#3771c8",
":hover": {
"background-color": "#3266b4"
},
":focus": {
"background-color": "#3266b4"
}
},
"footer": {
"background-color": "#ffffff"
}
}
},
"modalProduct": {
"contents": {
"img": false,
"imgWithCarousel": true,
"variantTitle": false,
"buttonWithQuantity": false,
"quantity": false
},
"styles": {
"product": {
"@media (min-width: 601px)": {
"max-width": "100%",
"margin-left": "0px",
"margin-bottom": "0px"
}
},
"button": {
"background-color": "#3771c8",
"font-size": "15px",
":hover": {
"background-color": "#3266b4"
},
":focus": {
"background-color": "#3266b4"
}
}
}
},
"toggle": {
"styles": {
"toggle": {
"background-color": "#3771c8",
":hover": {
"background-color": "#3266b4"
},
":focus": {
"background-color": "#3266b4"
}
}
}
},
"productSet": {
"styles": {
"products": {
"@media (min-width: 601px)": {
"margin-left": "-20px"
}
}
}
}
});
通过使用上面的json,我可以在购物车中添加/编辑产品数量。
我只需要在购物车中添加一个数量,也不想在每次点击时添加数量" Shopify Buy Button"那我该怎么做呢?有人可以帮我吗?