Update operation in Cart Transform function not working even though the function's output is correct

Topic summary

A developer encountered an issue where a Cart Transform function returned what appeared to be correct output to update product pricing based on a metafield, but the cart price remained unchanged.

Problem Details:

  • The function output showed a proper update operation with a fixedPricePerUnit amount of “453.564”
  • Despite correct-looking output, the actual cart price didn’t reflect the change
  • Multiple active functions were present, with others returning empty operations

Resolution:
Another user identified that the amount field must be formatted with exactly 2 decimal places. After reformatting the price from “453.564” to 2 decimal places, the update operation worked correctly.

Key Takeaway:
Shopify’s Cart Transform function requires strict decimal formatting (2 places) for price amounts, though the system doesn’t report an error when this requirement isn’t met—leading to silent failures that can be confusing to debug.

Summarized with AI on November 11. AI used: claude-sonnet-4-5-20250929.

We want to change the price of product on basis of function metafield. The function output returned is correct, but the price is not being updated on to the cart.

Here is the output of the function.

{
  "operations": [
    {
      "update": {
        "cartLineId": "gid://shopify/CartLine/54903535-a7ee-4140-840d-d889755d7008",
        "price": {
          "adjustment": {
            "fixedPricePerUnit": {
              "amount": "453.564"
            }
          }
        }
      }
    }
  ]
}

But still the price is not changed, Here is the snapshot from cart.

Below screenshot shows actual product price.

As per the function output price should have changed, but it is still the same. Please let me know, what the cause maybe ?

Note -
I have multiple functions active which returns empty operation.

{
  "operations": []
}
1 Like

Hey! I faced a similar issue, turns out the amount has to be fixed to 2 decimal places.

Thank you so much for your answer. I changed the decimal places to 2 and it worked. Strange behaviour, Shopify should at least report error if output is incorrect.