Out now! Check out the Poll results: Do you have a Shopify store?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

bulk operation not getting me correct data

bulk operation not getting me correct data

tejasvyas
Shopify Partner
11 0 5

I am trying to perform the bulk operation to fetch the contextual prices. Here is the Query:

mutation {
  bulkOperationRunQuery(
   query"""
    {
      FiPrices: productVariants {
    edges {
      node {
        id
         contextualPricing(context: {country: FI}) {
            compareAtPrice{
                amount
                currencyCode
            }
            price{
                amount
                currencyCode
            }
            }
      }   
    }
  } 
    AuPrices: productVariants {
        edges {
          node {
            id
             contextualPricing(context: {country: AU}) {
                compareAtPrice{
                    amount
                    currencyCode
                }
                price{
                    amount
                    currencyCode
                }
                }
          }   
        }
      }
    }
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}
 
But Everytime, the record count is incorrect and different, I am trying to fetch contextual prices of multiple context which works in Graph QL but does not work with Bulk, try this and you can find that it works normally:


 
query
{
  FIproductVariants(first20) {
    edges {
      node {
        id
         contextualPricing(context: {countryFI}) {
            compareAtPrice{
                amount
                currencyCode
            }
            price{
                amount
                currencyCode
            }
            }
      }   
    }
  } 
USproductVariants(first20) {
    edges {
      node {
        id
         contextualPricing(context: {countryUS}) {
            compareAtPrice{
                amount
                currencyCode
            }
            price{
                amount
                currencyCode
            }
            }
      }   
    }
  }  
}
Replies 6 (6)

skraloupak
Shopify Partner
27 3 3

Hello,

have you found a solution? 

 

Regards

Jan

tejasvyas
Shopify Partner
11 0 5

Hi, No unfortunately, we would stop using bulk operations now. 

 

Regards

Tejas

skraloupak
Shopify Partner
27 3 3

Thank you Tejas for reply.

Did you try to use this variant in the bulk?

 

query MyQuery {
products(first: 10) {
nodes {
title
variants(first: 10) {
nodes {
price
prices_MX: contextualPricing(context: {country: MX}) {
price {
amount
currencyCode
}
compareAtPrice {
amount
currencyCode
}
}
prices_CZ: contextualPricing(context: {country: CZ}) {
price {
amount
currencyCode
}
compareAtPrice {
amount
currencyCode
}
}
}
}
}
}
}

 

 
Only problem is where to pull all available contextual countries for the store.

Jan
tejasvyas
Shopify Partner
11 0 5

Well, we changed the approach to use webhooks for the markets prices but for fetching the contextual countries, markets API call would be helpful:

query Markets {
  markets(first: 7) {
    nodes {
      id
      name
      regions(first: 7) {
        pageInfo {
          hasNextPage
        }
        nodes {
          name
          ... on MarketRegionCountry {
            code
          }
        }
      }
      enabled
      webPresence {
        rootUrls {
          locale
          url
        }
      }
    }
  }
}
skraloupak
Shopify Partner
27 3 3

That's what I was looking for. I figured it out once but I couldn't find it again. Probably, you are using productFeeds for webhook pricing, right?

 

Thank you for your time and help, I appreciate it

Jan

tejasvyas
Shopify Partner
11 0 5

Yes, its product feed for the prices. 🙂 

 

Regards

Tejas