SHOPIFY APP DISCOUNT FUNCTION

Hello, everyone,

We are developing an application that performs automatic discounts based on product metafiles.

This application makes use of comparison pricing.

As per the documentation, we are retrieving the compareAtAmountPerQuantity field

https://shopify.dev/docs/api/functions/reference/delivery-customization/graphql/common-objects/cartlinecost

Until a few weeks ago, the function worked perfectly by retrieving the right value of the comparison price.

But since a few days, that value is always null even though the product actually has the comparison price.

Can you explain why this is the case?

I have also tried calling Graphql api and even then the comparison price is always null.

query Input {

  cart {
        buyerIdentity {
              email
              customer{
                  hasTags(tags : ["star","vip","clienti","fidelity","vipmaffle"]){
                            hasTag
                            tag
                  }
              }
        }
        lines {
          id
          cost{
               prezzo: amountPerQuantity{
                                 amount
               }
               prezzoDiConfronto: compareAtAmountPerQuantity{
                                 amount
               }

          }
          merchandise {
                __typename
                ... on ProductVariant {
                  product {
                          star: metafield(namespace: "custom", key: "star") {
                                   jsonValue
                          }
                          vip: metafield(namespace: "custom", key: "vip") {
                                   jsonValue
                          }
                          clienti: metafield(namespace: "custom", key: "clienti") {
                                   jsonValue
                          }
                         fidelity: metafield(namespace: "custom", key: "fidelity") {
                                   jsonValue
                         }
                         vipmaffle: metafield(namespace: "custom", key: "vipmaffle") {
                                   jsonValue
                         }
                  }
                }
          }
        }
  }

  shop {
    localTime {
      date
    }
  }
}
{  "cart": {    "buyerIdentity": {      "email": "alessandroferraiuolo2@gmail.com",      "customer": {        "hasTags": [          {
            "hasTag": false,            "tag": "star"
          },
          {
            "hasTag": false,            "tag": "vip"
          },
          {
            "hasTag": true,            "tag": "clienti"
          },
          {
            "hasTag": false,            "tag": "fidelity"
          },
          {
            "hasTag": false,            "tag": "vipmaffle"
          }
        ]
      }
    },
    "lines": [      {
        "id": "gid://shopify/CartLine/0",        "cost": {          "prezzo": {            "amount": "110.0"
          },
          **"prezzoDiConfronto": null**
        },
        "merchandise": {          "__typename": "ProductVariant",          "product": {            "star": null,            "vip": null,            "clienti": {              "jsonValue": {                "valore": 90,                "dataStart": "2024-09-01T05:00:00Z",                "dataEnd": "2024-09-10T15:30:00Z"
              }
            },
            "fidelity": null,            "vipmaffle": null
          }
        }
      }
    ]
  },
  "shop": {    "localTime": {      "date": "2024-09-07"
    }
  }
}
 

 

Hey .Did you manage to fix ?

Yes with this topic:
https://community.shopify.com/post/2761466