Personalized checkout and custom promotions with Shopify Scripts
Hi, I'm trying to create custom cart_attribute, but I'm not able to find that cart_attribute that I POST with graphQL in shopify backend. Am i missing anything?
Here's what I did
<fetcher.Form action="/cart" method="post">
<input type="hidden" name="cartAction" value={CartAction.ADD_TO_CART} />
<input
type="hidden"
name="lines"
id="lines"
value={JSON.stringify(lines)}
/>
<input
type="hidden"
name="attributes"
id="attributes"
value={JSON.stringify(props?.attributes)}
/>
<input type="hidden" name="analytics" value={JSON.stringify(analytics)} />
<Button
as="button"
type="submit"
width={width}
variant={variant}
className={className}
disabled={disabled ?? fetcherIsNotIdle}
{...props}
>
{children}
</Button>
</fetcher.Form>
And also I wired that into cart action
if (!cartId) {
result = await cartCreate({
input: countryCode
? {lines, buyerIdentity: {countryCode}, attributes}
: {lines, attributes},
storefront,
});
} else {
result = await cartAdd({
cartId,
lines,
storefront,
});
}
I'm sure the custom property is wired in this cart, so the question is how do i checkout this custom data?
I just solved the issue. I need to put that in lines array
User | RANK |
---|---|
2 | |
2 | |
2 | |
2 | |
2 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023