"compareAtAmountPerQuantity" is broken in Discounts API function but works in Cart Transform API

Solved

"compareAtAmountPerQuantity" is broken in Discounts API function but works in Cart Transform API

AncleMarvel
Shopify Partner
4 0 4

THE VIDEO OF THE ISSUE

 

Short explanation: I added 2 products to a cart, checked logs of my 2 extensions. Inside of the extensions which uses Discounts API function I got null value for the field  compareAtAmountPerQuantity but logs for the extension which uses Cart Transform API it shows correct values.

 

 

AncleMarvel_0-1726051831574.png


But I received nulls in the input for Discounts API function:

{
  "cart": {
    "buyerIdentity": {
      "email": "[email protected]",
      "customer": null
    },
    "isCompareAtDiscount": {
      "value": "true"
    },
    "lines": [
      {
        "id": "gid://shopify/CartLine/0",
        "quantity": 1,
        "merchandise": {
          "__typename": "ProductVariant",
          "id": "gid://shopify/ProductVariant/42115752034358",
          "product": {
            "isEligibleForDiscounting": true,
            "productType": "Hydration Tub",
            "title": "Cranberry",
            "id": "gid://shopify/Product/7289090277430",
            "score": null
          }
        },
        "cost": {
          "amountPerQuantity": {
            "amount": "39.99"
          },
          "compareAtAmountPerQuantity": null,
          "subtotalAmount": {
            "amount": "39.99"
          },
          "totalAmount": {
            "amount": "39.99"
          }
        }
      },
      {
        "id": "gid://shopify/CartLine/1",
        "quantity": 1,
        "merchandise": {
          "__typename": "ProductVariant",
          "id": "gid://shopify/ProductVariant/43039432835126",
          "product": {
            "isEligibleForDiscounting": true,
            "productType": "Shaker",
            "title": "2024 Shaker",
            "id": "gid://shopify/Product/7658676944950",
            "score": null
          }
        },
        "cost": {
          "amountPerQuantity": {
            "amount": "9.99"
          },
          "compareAtAmountPerQuantity": null,
          "subtotalAmount": {
            "amount": "9.99"
          },
          "totalAmount": {
            "amount": "9.99"
          }
        }
      }
    ]
  },
  "shop": {
    "config": null
  }
}

And correct values in the Cart Transform API function:

{
  "cart": {
    "lines": [
      {
        "id": "gid://shopify/CartLine/a0a735ab-a3db-41fe-bb6b-a63eda290890",
        "quantity": 1,
        "routineID": null,
        "setID": null,
        "giftsCreatorID": null,
        "merchandise": {
          "id": "gid://shopify/ProductVariant/42115752034358",
          "product": {
            "productType": "Hydration Tub"
          }
        },
        "cost": {
          "amountPerQuantity": {
            "amount": "39.99"
          },
          "compareAtAmountPerQuantity": {
            "amount": "50.0"
          },
          "subtotalAmount": {
            "amount": "39.99"
          },
          "totalAmount": {
            "amount": "39.99"
          }
        }
      },
      {
        "id": "gid://shopify/CartLine/c7d70b81-8396-43ce-8b93-1b48d1c3a89b",
        "quantity": 1,
        "routineID": null,
        "setID": null,
        "giftsCreatorID": null,
        "merchandise": {
          "id": "gid://shopify/ProductVariant/43039432835126",
          "product": {
            "productType": "Shaker"
          }
        },
        "cost": {
          "amountPerQuantity": {
            "amount": "9.99"
          },
          "compareAtAmountPerQuantity": {
            "amount": "20.0"
          },
          "subtotalAmount": {
            "amount": "9.99"
          },
          "totalAmount": {
            "amount": "9.99"
          }
        }
      }
    ]
  },
  "shop": {
    "bundlesConfig": {
      "value": "{\"setID\":{\"parentProductTitle\":\"Set Creator\",\"parentVariantId\":42928873111606,\"thresholdDiscounts\":{\"3\":10}},\"giftsCreatorID\":{\"parentProductTitle\":\"Gift Box Creator\",\"parentVariantId\":42928873111606,\"thresholdDiscounts\":{\"3\":10}},\"routineID\":{\"parentProductTitle\":\"Routine Generator\",\"parentVariantId\":42928873111606,\"thresholdDiscounts\":{\"3\":10}}}"
    }
  }
}
Accepted Solution (1)

jfeuchtertqgg
Shopify Partner
2 1 7

This is an accepted solution.

Hey @AncleMarvel I've heard back from Shopify and problably you have too. For anyone else it seems there is a setting in the markets which affect the display of the compareAtAmountPerQuantity. This is if you go to Settings>Markets>preferences and toggling off the Hide Compare at Pricing:

 

11-21-95041-88931.png

 

 Deactivating this worked for us at least. We are still checking to see what sideeffects this might have though. So test and use with caution haha.

View solution in original post

Reply 1 (1)

jfeuchtertqgg
Shopify Partner
2 1 7

This is an accepted solution.

Hey @AncleMarvel I've heard back from Shopify and problably you have too. For anyone else it seems there is a setting in the markets which affect the display of the compareAtAmountPerQuantity. This is if you go to Settings>Markets>preferences and toggling off the Hide Compare at Pricing:

 

11-21-95041-88931.png

 

 Deactivating this worked for us at least. We are still checking to see what sideeffects this might have though. So test and use with caution haha.