Hi community, I need to replicate the same behavior from the following Storefront API GraphQL Query in Admin API. Is that possible? What I am trying to achieve:
- Write a query which I can use to obtain Product price for specific market (country) by providing Product ID and Market (country) identifier (via Admin API)
- Write a query which I can use to update the price for specific Product on a specific Market (country) by providing Product ID, Market (country) identifier and the new price (via Admin API)
query Products @inContext(country: DE) {
product(id: "gid://shopify/Product/8298182410528") {
productType
id
title
description
handle
priceRange {
minVariantPrice {
amount
currencyCode
}
}
}
}
Thanks for help ![]()
Martin
UPDATE 1:
I solved the first question, here is my solution:
query GetPrice {
productVariant(id: "gid://shopify/ProductVariant/45658915078432") {
id
contextualPricing(context: {country: DE}) {
price {
amount
currencyCode
}
}
}
}
-------------
UPDATE 2:
Setting the price for specific market is way more difficult. So far, I have this code which allows me to update the price, but it does it for primary market and I see no option to specify different one.
mutation UpdateProductPriceOnSpecificMarket {
productVariantUpdate(
input: {
id: "gid://shopify/ProductVariant/46244544151840",
price: 123456.00
}
) {
productVariant {
id
contextualPricing(
context: {
country: DK
}
) {
price {
amount
currencyCode
}
}
}
}
}