Compare at price is not visible in storefront api

Compare at price is not visible in storefront api

siddharth_CW
Shopify Partner
1 0 0

My default market is Denmark, and the compare at price is displayed by default on the product page.
However, when I fetch data for this product using the Storefront GraphQL API, the compareAtPrice field returns null

 

 

 

 

// variant id mentioned below is a dummy one
query Product @inContext(country: DK, language: EN) {
  productVariant445: node(id: "gid://shopify/ProductVariant/445") {
    ...on ProductVariant {
      id
      title
      price {
        amount
        currencyCode
      }
      compareAtPrice {
        amount
        currencyCode
      }
    }
  }
}

 

 

 

 

The compareAtPrice value only appears in the Storefront API after I disable the "Compare-at price hiding" toggle in Markets => Preferences => Price

Over here: it is mentioned that even though the "Compare-at price hiding" toggle is on, if the default market is eu then we need to show compare at price 

https://help.shopify.com/en/manual/compliance/legal/pricing-indication-directive#use-the-compare-at-...

How do i handle this in storefront? why is there a disparity here?

Replies 0 (0)