CartTransform/Bundles not working with Gift Cards

Topic summary

Issue: Gift cards fail to apply when items are bundled via a Shopify Cart Transform (lineExpand). They work on the same variants when added as individual line items, but at checkout for the bundle, a generic error appears: “Your gift card can no longer be applied to this order and has been removed.”

Context: The bundle is created using the lineExpand operation that splits a single cart line into two expanded items: (1) the original merchandise priced at 0.0, and (2) a “special fee” variant priced to the original line’s cost (using fixedPricePerUnit). Cart Transform is a Shopify Function that programmatically modifies cart lines; lineExpand turns one line into multiple lines to represent bundles.

Evidence: A code snippet of the expand operation is provided and is central to understanding the pricing structure (zero-priced item + fee variant carrying full cost).

Status: No resolution or official guidance provided in the thread. Open questions include whether gift cards are unsupported with lineExpand bundles, zero-priced items, or fee-variant pricing, and whether a workaround or configuration change is required.

Summarized with AI on December 22. AI used: gpt-5.

I am trying to get Gift Cards to apply towards bundles I create via a Cart Transform Function.

The gift card applies fine on the same variants as individual line items in my cart.
But when a bundle is created from them (lineExpand operation) I get the generic error in checkout

Your gift card can no longer be applied to this order and has been removed.

Here is the expand operation for reference:

const {id: cartLineId, merchandise, cost} = lineItem
const operation = {
  lineExpand:{
    cartLineId,
    title: 'Bundle of two things',
    expandedCartItems: [
      {
        merchandiseId: merchandise.id,
        quantity: 1,
        price: {
          adjustment: {
            fixedPricePerUnit: {amount: 0.0} // Adjust price to zero
          }
        }
      },
      {
        merchandiseId: specialFeeVariantId,
        quantity: 1,
        price: {
          adjustment: {
            fixedPricePerUnit: {
              amount: cost.amountPerQuantity.amount // cost on this lineitem
            }
          }
        }
      },
    ],
  }
}


Hi @bryan-revive is this just a sequence problem, what happens if a bundle is already in the cart, etc
Meanwhile it’s one more hurdle but for development related things use the actual dev forums.
The merchant forums are a hot aislop mess more and more so not a good noise/ratio in replies for people willing to put in actual effort & clarity in their posts.

it’s the same forum-software so you can copy-paste the post-editing-content from here to there, as there’s no transfer or linked account system

Not sure if it is sequential. If I add the giftcard in checkout without the bundle, return to shop, add the bundle, return to checkout and the giftcard is gone and will not apply.
I’ll try posting on the dev forum instead. Would normally post on official Discord and Slack channels but those were shutdown. Thanks for your input and guidance here.

1 Like