How can I update the cart line items before merge them into bundles

Topic summary

Core Issue:
A developer needs to update cart line item prices before merging them into bundles (frames with add-ons like lenses and coatings). The current approach—executing update operations followed by merge operations—fails because the price adjustments don’t carry through to the merged bundles.

Technical Constraint:
Operations are deduplicated and processed without guaranteed ordering, making it impossible to sequentially update and then merge the same cart lines.

Current Limitation:
Bundle-level percentage discounts exist but are insufficient. The requirement is for fixed price adjustments at the individual cart line level that persist through the merge.

Proposed Workarounds:

  • Use percentage decreases to achieve the desired amount (though this may not be flexible enough)
  • Combine product discounts with the cart transform function, passing bundle details to a separate discount function

Status:
Unresolved. Another user encountered the identical problem and is seeking updates on any solutions found.

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

I have multiple line items in the cart, including frames and add-ons such as lenses and lens coatings. I aim to consolidate these items into bundles to streamline the customer experience by not displaying individual add-ons. However, before bundling, I need to adjust the pricing to align with our pair pricing sales plan. Currently, I’m executing the update operation prior to the merge operation, but it appears that the pricing updates are not being applied to the merged bundles.

I’m aware that there’s a price adjustment applied at the bundle level, but it’s a percentage decrease which isn’t sufficient for our needs. We require price adjustments to be applied at the cart line item level when merging line items.

I attempted to carry out the operations separately, first updating and then merging. However, it seems that the pricing isn’t getting updated within the bundles.

Do you have any suggestions on how I can ensure that the pricing adjustments are correctly applied during the merge process?

Here is Input query:

query RunInput {
  cart {
    lines {
      id
      quantity
      cost {
        amountPerQuantity {
          amount
          currencyCode
        }
      }
      # Cart line attribute to get the uuid
      groupId: attribute(key: "_groupId") {
        key
        value
      }
      merchandise {
        __typename
        ... on ProductVariant {
          id
          title
          product {
            id
            title
            productType
        }   
      }
    }
  }
 }
}

Here is the output

{
  "operations": [
    {
      "update": {
        "cartLineId": "gid://shopify/CartLine/f51c4593-6924-4588-a07f-c2eaf366504d",
        "price": {
          "adjustment": {
            "fixedPricePerUnit": {
              "amount": 49.99
            }
          }
        }
      }
    },
    {
      "update": {
        "cartLineId": "gid://shopify/CartLine/667d7210-7ede-4fa4-bc9c-f74e7ba0415b",
        "price": {
          "adjustment": {
            "fixedPricePerUnit": {
              "amount": 49.99
            }
          }
        }
      }
    },
    {
      "update": {
        "cartLineId": "gid://shopify/CartLine/cd5675f9-e5e7-4436-9dd1-a7d941d87f5c",
        "price": {
          "adjustment": {
            "fixedPricePerUnit": {
              "amount": 49.99
            }
          }
        }
      }
    },
    {
      "update": {
        "cartLineId": "gid://shopify/CartLine/7715b663-aeaa-4e64-97bd-9931f679b05d",
        "price": {
          "adjustment": {
            "fixedPricePerUnit": {
              "amount": 49.99
            }
          }
        }
      }
    },
    {
      "update": {
        "cartLineId": "gid://shopify/CartLine/0e5ccd88-1249-4104-884c-d1b73508cc71",
        "price": {
          "adjustment": {
            "fixedPricePerUnit": {
              "amount": 49.99
            }
          }
        }
      }
    },
    {
      "merge": {
        "parentVariantId": "gid://shopify/ProductVariant/43955741491361",
        "title": "Bill Bass : Reema",
        "image": {
          "url": "https://cdn.shopify.com/s/files/1/0634/0624/4001/files/BILL_BASS-REEMA-9416996015538-1.jpg?v=1711595712"
        },
        "cartLines": [
          {
            "cartLineId": "gid://shopify/CartLine/f51c4593-6924-4588-a07f-c2eaf366504d",
            "quantity": 1
          },
          {
            "cartLineId": "gid://shopify/CartLine/667d7210-7ede-4fa4-bc9c-f74e7ba0415b",
            "quantity": 1
          },
          {
            "cartLineId": "gid://shopify/CartLine/cd5675f9-e5e7-4436-9dd1-a7d941d87f5c",
            "quantity": 1
          },
          {
            "cartLineId": "gid://shopify/CartLine/7715b663-aeaa-4e64-97bd-9931f679b05d",
            "quantity": 1
          }
        ]
      }
    }
  ]
}

Hi @Natasha023

Operations are deduplicated and reduced together, there is no ordering to them. So it’s not possible to update and merge the same cart lines. Can you use a percentage decrease to reduce the price to the desired amount?

-Nick

I am thinking of a solution, that you use product discount in combine with your cart transform function but I guess you have to pass bundle details to your discount function.

Hey Natasha, I ran into the exact same problem, were you able to figure out a way or is it still not fixed ? @Natasha023

CC: @Nick_Wesselman @mahdi-akbary any news from you guys here?