Remix app and cart transform

How to use the data information saved in the remix app in the cart transform extension function. Do you have any relevant cases to look at。

Hey @yirong_xie :waving_hand: - the Cart Transform extension technically works separately from the Remix side of the app, but you should be able to share information between them (for example, product IDs that are set in the Remix embedded UI).

Functions can’t directly access or modify the Remix app’s state or vice versa though. Would you be open to sharing your use case/plan for your app and I’d be happy to see if we can share some further guidance for you?

Hope this helps a bit at least :slight_smile:


As shown in the picture, I have installed the Shopify app (Magical Product Fees). In this app, I have created three types of additional fee entries, each corresponding to one of my product series. When I add a product to my shopping cart, the Shopify function will perform a cart transform expand operation to extend an additional fee product for each product. I want to know how the cart transform Shopify function knows which additional fee product to expand for the product added to my shopping cart. You can try installing this app because I am also imitating and developing similar features to this app myself, but I am not sure how it is implemented. Thank you!

You save the data to a metafield which is owned by the CartTransform resource. You can then access that data in the function itself. Here’s the documentation: Metafields for input queries

1 Like
mutation cartTransformCreate($blockOnFailure: Boolean, $functionId: String!, $metafields: [MetafieldInput!]) {
  cartTransformCreate(blockOnFailure: $blockOnFailure, functionId: $functionId, metafields: $metafields) {
    cartTransform {
      id
      functionId
    }
    userErrors {
      field
      message
    }
  }
}

Do you mean to save information in Metafields when creating using cartTransformCreate? Will there be a size limit for this storage? What should I do to update it? I checked the Shopify admin API documentation and only found the APIs for creating and deleting it

This guide walks you through step by step, so I’d recommend just going through that tutorial to learn how things work:

Here is my scene:

1、My product was created through the Shopify admin backend

2、I am developing an app using remix, and this app comes with a cart transform function extension

3、My idea is to use the remix app to set up settings for a product or a series of products, so that when I add a product to my shopping cart, I can expand it into the product itself and create another product set up by my app

Where should I save the information set in the remix app? If according to the document you provided, when I select a series of products in my app and bind them to the same extension product, I have to set up metafields for each product, which is not a good solution. My question is how to properly store information in my app so that I can retrieve it from RunInput in the cart transform function and use it to write the extension logic for the cart transform.

Hello yirong_xie :
Think of the solution in two steps :

  1. Remix : to manage meta data at store, product,varinat , collection level.
  2. Use cart transform to parse the cart and based on the meta data( business logic and rules ) code the cart transform.

So first define meta data schema that will result in data being available when the cart transform code is invoked.

Here in cart transform you can replace a product with another product, create a bundle , split a bundle or add an additional product.

Based on whats all products in cart you will get the product meta associated.
Store Meta will be available as a global data.

If you can share an exact use case of a cart input and a converted cart output will help comment further.

Hi @yirong_xie

Did the advice shared above help to resolve this issue?