Support global cart metadata
notrab opened this issue Β· comments
Jamie Barton commented
Similar to what happens with CartQL, it would be good to support a updateCart
function that allows you to set global metadata on the cart.
This can be helpful for tracking any order notes, coupon codes, etc.
Example:
const { updateCart } = useCart()
updateCart({
coupon: 'FREESHIPPING'
})
The only thing that would need decided is how to access this. I'd prefer to namespace this under metadata
, so you'd be able to do:
function () {
const { metadata } = useCart()
return (
<p>{metadata.coupon}</p>
)
}
Jamie Barton commented
What should we call this function?
π for updateCart
π for updateCartMeta
π for updateCartMetadata
github-actions commented
π This issue has been resolved in version 1.11.0 π
The release is available on:
Your semantic-release bot π¦π