How can i add metafields to cart.items object in cart.js api?

shbov
New Member
1 0 0

Hello! How can i add metafields to cart.items object in cart.js api?

0 Likes
samthewebb
Shopify Partner
24 3 2

You can't. Metafields are custom fields you add to Shopify objects in the back end. You don't add metafields through front end AJAX APIs.

Unless you're talking about line item properties which Shopify has good documentation on https://shopify.dev/api/ajax/reference/cart#private-properties-and-attributes

Sam Webb
https://samthewebb.com
sam@samthewebb.com
0 Likes