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

shbov
Visitor
1 0 0

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

Reply 1 (1)

samthewebb
Shopify Partner
25 3 6

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