Personalized checkout and custom promotions with Shopify Scripts
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
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