Last active
October 5, 2021 04:59
-
-
Save cpv123/ccd3957079087c9441d786cee84c6ba6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const handleAddToCart = async () => { | |
try { | |
const { cart } = await commerce.cart.add(product.id, quantity) | |
setCart(cart) | |
plausible("addProductToCart", { | |
props: { | |
productName: product.name, | |
} | |
}) | |
} catch (error) { | |
plausible("addProductToCartError", { | |
props: { | |
productName: product.name, | |
error: error.message, | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment