Cart Transform Extension Bug in Gift Card Products

Topic summary

A developer encounters a 422 error when using the cart transform extension’s expand operation with Gift Card Template products. The error message states “The bundle product ‘product_name’ cannot be added to the cart,” yet the product successfully adds to the cart despite the error.

Key Details:

  • Error occurs specifically with Gift Card Template products during expand operations
  • Status code: 422 (Unprocessable Content)
  • Product adds to cart successfully, but error still appears
  • Similar issue previously reported in Shopify community forums

Technical Context:
The developer provided input/output examples and extension configuration files (cargo.toml, shopify.extension.toml), though portions appear corrupted or reversed in the post. The cart transform extension targets API version 2024-07 and uses standard Shopify function dependencies.

Current Status:
The issue remains unresolved with no responses or solutions provided yet. The developer seeks troubleshooting assistance for this optimization problem affecting their cart transform functionality.

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

Hello everyone, during the expand operation using the cart transform plugin, I get the error “The bundle product ‘product_name’ cannot be added to the cart.” when adding “Gift Card Template” products to the cart. Although the error occurs, the product is added to the cart.

Similar Problem:
https://community.shopify.com/c/bundles/422-unprocessable-content-when-adding-bundle-with-expand-to-cart/m-p/2507084

ERROR:

{
    "status":  422,
    "message":  "Cart Error",
    "description":  "The bundle product 'Selling - 9\"' cannot be added to the cart."
}

INPUT:

{
  "cart": {
    "lines": [
      {
        "id": "gid://shopify/CartLine/002495c7-645e-4050-8f64-93ecaed0608a",
        "quantity": 1,
        "cost": {
          "amountPerQuantity": {
            "amount": "24.95"
          }
        },
        "merchandise": {
          "__typename": "ProductVariant",
          "id": "gid://shopify/ProductVariant/41212268773453",
          "product": {
            "id": "gid://shopify/Product/7306174201933",
            "handle": "selling-plans-ski-wax",
            "title": "Selling Plans Ski Wax"
          }
        }
      }
    ]
  }
}

OUTPUT:

{
  "operations": [
    {
      "expand": {
        "cartLineId": "gid://shopify/CartLine/002495c7-645e-4050-8f64-93ecaed0608a",
        "expandedCartItems": [
          {
            "merchandiseId": "gid://shopify/ProductVariant/41212268773453",
            "price": {
              "adjustment": {
                "fixedPricePerUnit": {
                  "amount": "99.80"
                }
              }
            },
            "quantity": 1
          }
        ],
        "title": "Selling Plans Ski Wax"
      }
    }
  ]
}

CART:

CART TRANSFORM EXTENSION:

Cargo.toml :

[package]
name = "cart-transform-example"
version = "1.0.0"
edition = "2021"
rust-version = "1.62"

[dependencies]
rust_decimal = "1.27.0"
serde = { version = "1.0.13", features = ["derive"] }
serde_with = "1.13.0"
serde_json = "1.0"
shopify_function = "0.8.0"
graphql_client = "0.14.0"

[profile.release]
lto = true
opt-level = 's'
strip = true

shopify.extension.toml:

api_version = "2024-07"

[[extensions]]
name = "t:name"
handle = "cart-transform-example"
type = "function"

description = "t:description"

  [[extensions.targeting]]
  target = "purchase.cart-transform.run"
  input_query = "src/run.graphql"
  export = "run"

  [extensions.build]
  command = "cargo wasi build --release"
  path = "target/wasm32-wasi/release/cart-transform-example.wasm"
  watch = [ "src/**/*.rs" ]

  [extensions.ui.paths]
  create = "/"
  details = "/"