Cart Transform Extension Bug in Gift Card Products

Cart Transform Extension Bug in Gift Card Products

Perugia
Shopify Partner
1 0 0

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-...

 

ERROR:

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

gift-card-product-transform-bug.png

 

 

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:

Perugia_2-1726576449751.png

 

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 = "/"

 

 

 

Replies 0 (0)