BulkQuery ProductVariants contextualPricing & locale

BulkQuery ProductVariants contextualPricing & locale

sanjar
Shopify Partner
21 1 2

Hello!

I'm creating a full store products & variants sync operation. As you can see in request I'm trying to get all available store locales and markets (contextualPricing).

 

 

 

 

{
  productVariants(query: "product_status:active", reverse: true) {
    edges {
      node {
        id
        price
        compareAtPrice
        price_RU: contextualPricing(context: {country: RU}) {
          price {
            amount
            currencyCode
          }
          compareAtPrice {
            amount
            currencyCode
          }
        }
        price_FR: contextualPricing(context: {country: FR}) {
          price {
            amount
            currencyCode
          }
          compareAtPrice {
            amount
            currencyCode
          }
        }
        variant_ru: translations(locale: "ru") {
          locale
          key
          value
        }
        variant_fr: translations(locale: "fr") {
          locale
          key
          value
        }
        product {
          id
          onlineStorePreviewUrl
          featuredImage {
            id
            url
          }
          product_ru: translations(locale: "ru") {
            locale
            key
            value
          }
          product_fr: translations(locale: "fr") {
            locale
            key
            value
          }
          options {
            id
            name
            position
            values
            option_ru: translations(locale: "ru") {
              key
              value
              locale
            }
            option_fr: translations(locale: "fr") {
              key
              value
              locale
            }
          }
          collections(first: 10) {
            edges {
              node {
                id
                title
                collection_ru: translations(locale: "ru") {
                  key
                  value
                  locale
                }
                collection_fr: translations(locale: "fr") {
                  key
                  value
                  locale
                }
              }
            }
          }
        }
      }
    }
  }
}

 

 

 

  

 

I understand that for locales I need to make request to get all shop locales and create query based on locales.

 

 

 

 

 product_ru: translations(locale: "ru") {
            locale
            key
            value
 }
 product_fr: translations(locale: "fr") {
            locale
            key
            value
 }

 

 

 

However, I'm not sure how to get all available contextualPricing directly in productVariants request. Making separate request to get list of countries and add it to productVariants request sound an overwhelming. 

Will be glad for any help. 

 

Thank you. 

Replies 0 (0)