Re: Is there any other way to update cart line item properties other than client side?

Is there any other way to update cart line item properties other than client side?

mdog
Shopify Partner
11 0 1

I've search the api/functions docs and haven't found anything yet - the cart transform has an update operation, but only allows updates to 4 properties of the cart line item (not the 'properties' property though)

Replies 4 (4)

Liam
Community Manager
3108 341 881

Hi Mdog - what would be the specific use case you'd be trying to achieve, where updating on the client side is not acceptable for you?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

mdog
Shopify Partner
11 0 1

Because it requires modifying several files which differ by theme.

 

To give more context, I have my own CarrierService implementation to which I need to pass some additional info for each cart line item - the CarrierService request only includes the Properties collection for line items. Would prefer to use a function/extension of some sort that would not have to be modified for each theme.

Liam
Community Manager
3108 341 881

From looking into this, it does seem that a cart transform function will not work for this. Could a theme app extension work instead? 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

mdog
Shopify Partner
11 0 1

The theme has to support app extensions, not sure all the themes we have do - and also the example given (main-product.liquid) is where I made the modifications - I can look at extracting just the piece I need but also had to modify the buy-buttons and global.js file - there's a lot of hoops to jump through to get a variant metafield to load when the page first renders and also react to when variants are chosen unfortunately. It really depends on how the theme has implemented the cart UX experience, doesn't seem like you can make a simple plug and play that will work 100%