Cart Transform API returns zero dollar costs for POS CustomProduct items

Cart Transform API returns zero costs for POS CustomProduct items

Functions • cart-transform

Hi everyone,

I’ve encountered an issue with the Cart Transform API when custom sale items are added via POS.

  • The function runs correctly for all cart updates
  • CustomProduct items show all cost fields as “0.0” (amountPerQuantity, subtotalAmount, totalAmount)
  • The prices only populate correctly at checkout time
  • This causes checkout failure when trying to use the CustomProduct cost as part of the cost calculation for a lineExpand operation due to cart total mismatch.

Expected

CustomProduct items should have their actual prices available in all cost fields during normal cart operations, not just at checkout time.

Actual

All cost fields return “0.0” for CustomProduct items during cart updates. Prices suddenly populate at checkout, causing the cart total to differ from what was calculated initially, resulting in checkout failure when using CustomProduct prices to calculate lineExpand prices.

Environment

  • Function type: Cart Transform
  • Channel: POS (Shopify Point of Sale)
  • API Version: 2025-07
  • Regular checkout: Works correctly (no CustomProduct items)

Code Example

Cart Transform function input when custom sale item is in cart:

{
  "presentmentCurrencyRate": "1.0",
  "localization": {
    "language": {
      "isoCode": "EN"
    }
  },
  "cart": {
    "lines": [
      {
        "id": "gid:\/\/shopify\/CartLine\/cf951760-ea73-4bca-9f68-aac8916910f7",
        "quantity": 1,
        "cost": {
          "amountPerQuantity": {
            "amount": "0.0",
            "currencyCode": "CAD"
          },
          "subtotalAmount": {
            "amount": "0.0",
            "currencyCode": "CAD"
          },
          "totalAmount": {
            "amount": "0.0",
            "currencyCode": "CAD"
          }
        },
        "merchandise": {
          "__typename": "CustomProduct"
        },
        "lineItemProperties": null
      }
    ]
  }
}

Cart Transform function input when trying to check out:

{
  "presentmentCurrencyRate": "1.0",
  "localization": {
    "language": {
      "isoCode": "EN"
    }
  },
  "cart": {
    "lines": [
      {
        "id": "gid:\/\/shopify\/CartLine\/cf951760-ea73-4bca-9f68-aac8916910f7",
        "quantity": 1,
        "cost": {
          "amountPerQuantity": {
            "amount": "130.0",
            "currencyCode": "CAD"
          },
          "subtotalAmount": {
            "amount": "130.0",
            "currencyCode": "CAD"
          },
          "totalAmount": {
            "amount": "130.0",
            "currencyCode": "CAD"
          }
        },
        "merchandise": {
          "__typename": "CustomProduct"
        },
        "lineItemProperties": null
      }
    ]
  }
}

Note: The CustomProduct line item was added with a price of $130.00, but all three cost fields show “0.0”.

Even if I continue to update the cart, including adding non-custom items, the CustomProduct line item cost fields continue to show “0.0”.

At checkout time, the function runs again and the CustomProduct’s amountPerQuantity suddenly shows “130.0”, causing a cart total mismatch that fails the checkout.

Has anyone else seen this behavior, or is there a workaround for accessing CustomProduct prices in Cart Transform functions?

1 Like

Hey @jeffchew , thanks for reaching out and sharing all of the info there. I’ve done a bit of digging into this and I do know there are some limitations of the Cart Transform API, but the behaviour you’re reporting here does sound odd.

Would you be open to sharing your shop domain (myshopify.com URL), the complete Cart Transform function code (both input query and function logic), and the exact error message you’re seeing when checkout fails if possible? Also, if you can confirm if this happens with all custom sale items or just certain ones that would be super helpful to narrow down the issue.

If it’s easier to share this information privately, feel free to let me know and I can set up a DM, then we can work through the details that way. Once I have those details from you, I’m more than happy to keep looking into this with you and potentially reach out to my team to investigate further.

Hi Alan,

Thanks for your reply! I would be happy to set up a DM to provide you with everything you need.

I can share some additional info here.

This happens on all custom sale items in POS.

This is an example of the input query:

query Input {
  presentmentCurrencyRate
  localization {
    language {
      isoCode
    }
  }
  cart {
    lines {
      id
      quantity
      cost {
        amountPerQuantity {
          amount
          currencyCode
        }
        subtotalAmount {
          amount
          currencyCode
        }
        totalAmount {
          amount
          currencyCode
        }
      }
      merchandise {
        __typename
        ... on ProductVariant {
          id
          title
          product {
            productType
          }
        }
      }
    }
  }
}

And here is the input result when I add a custom sale product costing $130 to my cart in the POS app:

{
  "presentmentCurrencyRate": "1.0",
  "localization": {
    "language": {
      "isoCode": "EN"
    }
  },
  "cart": {
    "lines": [
      {
        "id": "gid:\/\/shopify\/CartLine\/ff722b11-da80-4b09-9750-318399d7ac82",
        "quantity": 1,
        "cost": {
          "amountPerQuantity": {
            "amount": "0.0",
            "currencyCode": "CAD"
          },
          "subtotalAmount": {
            "amount": "0.0",
            "currencyCode": "CAD"
          },
          "totalAmount": {
            "amount": "0.0",
            "currencyCode": "CAD"
          }
        },
        "merchandise": {
          "__typename": "CustomProduct"
        }
      }
    ]
  }
}

Those amount values will continue to be zero, regardless of what cart modifications I make. For example, I’ll add a regular product to the cart:

{
  "presentmentCurrencyRate": "1.0",
  "localization": {
    "language": {
      "isoCode": "EN"
    }
  },
  "cart": {
    "lines": [
      {
        "id": "gid:\/\/shopify\/CartLine\/9544ecdc-8a6b-44a2-9e57-a80d1f67c702",
        "quantity": 1,
        "cost": {
          "amountPerQuantity": {
            "amount": "0.0",
            "currencyCode": "CAD"
          },
          "subtotalAmount": {
            "amount": "0.0",
            "currencyCode": "CAD"
          },
          "totalAmount": {
            "amount": "0.0",
            "currencyCode": "CAD"
          }
        },
        "merchandise": {
          "__typename": "CustomProduct"
        }
      },
      {
        "id": "gid:\/\/shopify\/CartLine\/9d8b2696-c568-4b79-a16e-b865ebb32ebc",
        "quantity": 1,
        "cost": {
          "amountPerQuantity": {
            "amount": "600.0",
            "currencyCode": "CAD"
          },
          "subtotalAmount": {
            "amount": "600.0",
            "currencyCode": "CAD"
          },
          "totalAmount": {
            "amount": "600.0",
            "currencyCode": "CAD"
          }
        },
        "merchandise": {
          "__typename": "ProductVariant",
          "id": "gid:\/\/shopify\/ProductVariant\/49499130265897",
          "title": null,
          "product": {
            "productType": "snowboard"
          }
        }
      }
    ]
  }
}

The values will only change from zero to reflect their actual values when I complete the checkout in the POS app.

{
  "presentmentCurrencyRate": "1.0",
  "localization": {
    "language": {
      "isoCode": "EN"
    }
  },
  "cart": {
    "lines": [
      {
        "id": "gid:\/\/shopify\/CartLine\/9544ecdc-8a6b-44a2-9e57-a80d1f67c702",
        "quantity": 1,
        "cost": {
          "amountPerQuantity": {
            "amount": "130.0",
            "currencyCode": "CAD"
          },
          "subtotalAmount": {
            "amount": "130.0",
            "currencyCode": "CAD"
          },
          "totalAmount": {
            "amount": "130.0",
            "currencyCode": "CAD"
          }
        },
        "merchandise": {
          "__typename": "CustomProduct"
        }
      },
      {
        "id": "gid:\/\/shopify\/CartLine\/9d8b2696-c568-4b79-a16e-b865ebb32ebc",
        "quantity": 1,
        "cost": {
          "amountPerQuantity": {
            "amount": "600.0",
            "currencyCode": "CAD"
          },
          "subtotalAmount": {
            "amount": "600.0",
            "currencyCode": "CAD"
          },
          "totalAmount": {
            "amount": "600.0",
            "currencyCode": "CAD"
          }
        },
        "merchandise": {
          "__typename": "ProductVariant",
          "id": "gid:\/\/shopify\/ProductVariant\/49499130265897",
          "title": null,
          "product": {
            "productType": "snowboard"
          }
        }
      }
    ]
  }
}

So that is the basis for my bug report, that the custom sale item costs in the Cart Transform input are 0 right up until taking payment.

I hope that helps. Let me know if you’d like to set up a DM or a meet or something so I can provide further details if necessary. Thanks!

Thanks for all of this @Jeffchew, really appreciate all of the detailed info, very helpful!

I’ll set up a DM now and loop back with you there to grab some more info. Speak with you there shortly!

Hey @jeffchew

Thanks again for your patience on this. After investigating this with some folks internally, I can confirm that this is actually expected behavior for custom products in POS. The cart lines for custom products will show up as 0.0 during normal cart operations, and they only get populated with the correct price at checkout time. This is how we currently handle custom sale items when they flow through the Cart Transform API.

The workaround here would be to skip custom product lines during your cart transform function runs. Since you mentioned you’re using CustomProduct costs as part of your lineExpand calculations, you’ll want to add logic to identify when merchandise.__typename is “CustomProduct” and skip those lines in your transform logic. Then at checkout when the prices populate, you can add any necessary discounts to avoid the cart and checkout price mismatch you were seeing if needed.

I definitely know this isn’t the ideal flow you were hoping for, but hopefully this helps explain what’s going on and gives you a path forward. Let me know if you have any questions about implementing this approach or if you run into any other issues!