I am developing a cart transform function that returns expand statements, and have troubles getting it to work. The function is registered and called as expected, and the calls succeed. The logs look good, the function returns expand operations as expected. However, they don’t have an effect on the cart. Including an example below. Any hints would be greatly appreciated.
Example input:
{
"cart": {
"lines": [
{
"id": "gid://shopify/CartLine/2cac2c06-f929-45d3-97a6-f02c47baa9bd",
"quantity": 1,
"cost": {
"amountPerQuantity": {
"amount": "10.0",
"currencyCode": "EUR"
},
"subtotalAmount": {
"amount": "10.0",
"currencyCode": "EUR"
},
"totalAmount": {
"amount": "10.0",
"currencyCode": "EUR"
}
},
"customPrice": {
"value": "48"
},
"merchandise": {
"__typename": "ProductVariant",
"id": "gid://shopify/ProductVariant/44751508308119",
"title": null,
"product": {
"id": "gid://shopify/Product/8607857311895",
"productConfiguration": {
"type": "metaobject_reference",
"value": "gid://shopify/Metaobject/82815746199"
}
}
}
},
{
"id": "gid://shopify/CartLine/592f9597-183c-4cc9-b904-3107660ee512",
"quantity": 1,
"cost": {
"amountPerQuantity": {
"amount": "10.0",
"currencyCode": "EUR"
},
"subtotalAmount": {
"amount": "10.0",
"currencyCode": "EUR"
},
"totalAmount": {
"amount": "10.0",
"currencyCode": "EUR"
}
},
"customPrice": null,
"merchandise": {
"__typename": "ProductVariant",
"id": "gid://shopify/ProductVariant/44751508308119",
"title": null,
"product": {
"id": "gid://shopify/Product/8607857311895",
"productConfiguration": {
"type": "metaobject_reference",
"value": "gid://shopify/Metaobject/82815746199"
}
}
}
}
]
},
"cartTransform": {
"customPriceProduct": {
"type": "variant_reference",
"value": "gid://shopify/ProductVariant/45002551099543"
}
},
"presentmentCurrencyRate": "1.0"
}
Example output:
{
"operations": [
{
"expand": {
"cartLineId": "gid://shopify/CartLine/2cac2c06-f929-45d3-97a6-f02c47baa9bd",
"title": "Test product",
"expandedCartItems": [
{
"merchandiseId": "gid://shopify/ProductVariant/44751508308119",
"quantity": 1
},
{
"merchandiseId": "gid://shopify/ProductVariant/45002551099543",
"quantity": 38
}
]
}
}
]
}
Maybe there are prerequisites on the product variants that I am missing?
Note: I verified that there is no general problem with the cart transform function by testing an update operation, which works as expected.