pass pricing to addItem call for verification and update cart API URL

Signed-off-by: Loan Laux <loan@outgrow.io>
This commit is contained in:
Loan Laux
2021-07-07 19:57:31 +03:00
parent c2c43b76aa
commit 4d48c511ca
3 changed files with 9 additions and 1 deletions

View File

@@ -29,9 +29,16 @@ const ProductSidebar: FC<ProductSidebarProps> = ({ product, className }) => {
const addToCart = async () => {
setLoading(true)
try {
console.log("product", product)
console.log("variant", variant)
await addItem({
productId: String(product.id),
variantId: String(variant ? variant.id : product.variants[0].id),
pricing: {
amount: variant ? Number.parseFloat(variant.price) : Number.parseFloat(product.price.value),
currencyCode: String(product.price.currencyCode),
}
})
openSidebar()
setLoading(false)