Version: 2024-07
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) { quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) { productVariants { id contextualPricing(context: {companyLocationId: $companyLocationId}) { quantityPriceBreaks(first: 1) { nodes { minimumQuantity price { amount currencyCode } } } quantityRule { minimum maximum increment } } } userErrors { message code field } } }\",\n \"variables\": {\n \"priceListId\": \"gid://shopify/PriceList/467640202\",\n \"companyLocationId\": \"gid://shopify/CompanyLocation/441870438\",\n \"input\": {\n \"quantityPriceBreaksToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"price\": {\n \"amount\": 35.0,\n \"currencyCode\": \"USD\"\n },\n \"minimumQuantity\": 10\n }\n ],\n \"quantityPriceBreaksToDelete\": [],\n \"quantityRulesToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"minimum\": 10,\n \"maximum\": 100,\n \"increment\": 5\n }\n ],\n \"quantityRulesToDeleteByVariantId\": [],\n \"pricesToAdd\": [\n {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"variantId\": \"gid://shopify/ProductVariant/113711323\"\n }\n ],\n \"pricesToDeleteByVariantId\": []\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) {\n quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) {\n productVariants {\n id\n contextualPricing(context: {companyLocationId: $companyLocationId}) {\n quantityPriceBreaks(first: 1) {\n nodes {\n minimumQuantity\n price {\n amount\n currencyCode\n }\n }\n }\n quantityRule {\n minimum\n maximum\n increment\n }\n }\n }\n userErrors {\n message\n code\n field\n }\n }\n }`,\n \"variables\": {\n \"priceListId\": \"gid://shopify/PriceList/467640202\",\n \"companyLocationId\": \"gid://shopify/CompanyLocation/441870438\",\n \"input\": {\n \"quantityPriceBreaksToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"price\": {\n \"amount\": 35.0,\n \"currencyCode\": \"USD\"\n },\n \"minimumQuantity\": 10\n }\n ],\n \"quantityPriceBreaksToDelete\": [],\n \"quantityRulesToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"minimum\": 10,\n \"maximum\": 100,\n \"increment\": 5\n }\n ],\n \"quantityRulesToDeleteByVariantId\": [],\n \"pricesToAdd\": [\n {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"variantId\": \"gid://shopify/ProductVariant/113711323\"\n }\n ],\n \"pricesToDeleteByVariantId\": []\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) {\n quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) {\n productVariants {\n id\n contextualPricing(context: {companyLocationId: $companyLocationId}) {\n quantityPriceBreaks(first: 1) {\n nodes {\n minimumQuantity\n price {\n amount\n currencyCode\n }\n }\n }\n quantityRule {\n minimum\n maximum\n increment\n }\n }\n }\n userErrors {\n message\n code\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"priceListId\": \"gid://shopify/PriceList/467640202\",\n \"companyLocationId\": \"gid://shopify/CompanyLocation/441870438\",\n \"input\": {\n \"quantityPriceBreaksToAdd\": [{\"variantId\"=>\"gid://shopify/ProductVariant/113711323\", \"price\"=>{\"amount\"=>35.0, \"currencyCode\"=>\"USD\"}, \"minimumQuantity\"=>10}],\n \"quantityPriceBreaksToDelete\": [],\n \"quantityRulesToAdd\": [{\"variantId\"=>\"gid://shopify/ProductVariant/113711323\", \"minimum\"=>10, \"maximum\"=>100, \"increment\"=>5}],\n \"quantityRulesToDeleteByVariantId\": [],\n \"pricesToAdd\": [{\"price\"=>{\"amount\"=>40.0, \"currencyCode\"=>\"USD\"}, \"variantId\"=>\"gid://shopify/ProductVariant/113711323\"}],\n \"pricesToDeleteByVariantId\": []\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) {\n quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) {\n productVariants {\n id\n contextualPricing(context: {companyLocationId: $companyLocationId}) {\n quantityPriceBreaks(first: 1) {\n nodes {\n minimumQuantity\n price {\n amount\n currencyCode\n }\n }\n }\n quantityRule {\n minimum\n maximum\n increment\n }\n }\n }\n userErrors {\n message\n code\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"priceListId\" => \"gid://shopify/PriceList/467640202\",\n \"companyLocationId\" => \"gid://shopify/CompanyLocation/441870438\",\n \"input\" => [\n \"quantityPriceBreaksToAdd\" => [{\"variantId\"=>\"gid://shopify/ProductVariant/113711323\", \"price\"=>{\"amount\"=>35.0, \"currencyCode\"=>\"USD\"}, \"minimumQuantity\"=>10}],\n \"quantityPriceBreaksToDelete\" => [],\n \"quantityRulesToAdd\" => [{\"variantId\"=>\"gid://shopify/ProductVariant/113711323\", \"minimum\"=>10, \"maximum\"=>100, \"increment\"=>5}],\n \"quantityRulesToDeleteByVariantId\" => [],\n \"pricesToAdd\" => [{\"price\"=>{\"amount\"=>40.0, \"currencyCode\"=>\"USD\"}, \"variantId\"=>\"gid://shopify/ProductVariant/113711323\"}],\n \"pricesToDeleteByVariantId\" => [],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) {\n quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) {\n productVariants {\n id\n contextualPricing(context: {companyLocationId: $companyLocationId}) {\n quantityPriceBreaks(first: 1) {\n nodes {\n minimumQuantity\n price {\n amount\n currencyCode\n }\n }\n }\n quantityRule {\n minimum\n maximum\n increment\n }\n }\n }\n userErrors {\n message\n code\n field\n }\n }\n }`,\n {\n variables: {\n \"priceListId\": \"gid://shopify/PriceList/467640202\",\n \"companyLocationId\": \"gid://shopify/CompanyLocation/441870438\",\n \"input\": {\n \"quantityPriceBreaksToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"price\": {\n \"amount\": 35.0,\n \"currencyCode\": \"USD\"\n },\n \"minimumQuantity\": 10\n }\n ],\n \"quantityPriceBreaksToDelete\": [],\n \"quantityRulesToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"minimum\": 10,\n \"maximum\": 100,\n \"increment\": 5\n }\n ],\n \"quantityRulesToDeleteByVariantId\": [],\n \"pricesToAdd\": [\n {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"variantId\": \"gid://shopify/ProductVariant/113711323\"\n }\n ],\n \"pricesToDeleteByVariantId\": []\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) {\n quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) {\n productVariants {\n id\n contextualPricing(context: {companyLocationId: $companyLocationId}) {\n quantityPriceBreaks(first: 1) {\n nodes {\n minimumQuantity\n price {\n amount\n currencyCode\n }\n }\n }\n quantityRule {\n minimum\n maximum\n increment\n }\n }\n }\n userErrors {\n message\n code\n field\n }\n }\n}"
input: { "priceListId": "gid://shopify/PriceList/467640202", "companyLocationId": "gid://shopify/CompanyLocation/441870438", "input": { "quantityPriceBreaksToAdd": [ { "variantId": "gid://shopify/ProductVariant/113711323", "price": { "amount": 35.0, "currencyCode": "USD" }, "minimumQuantity": 10 } ], "quantityPriceBreaksToDelete": [], "quantityRulesToAdd": [ { "variantId": "gid://shopify/ProductVariant/113711323", "minimum": 10, "maximum": 100, "increment": 5 } ], "quantityRulesToDeleteByVariantId": [], "pricesToAdd": [ { "price": { "amount": 40.0, "currencyCode": "USD" }, "variantId": "gid://shopify/ProductVariant/113711323" } ], "pricesToDeleteByVariantId": [] } }
response: { "data": { "quantityPricingByVariantUpdate": { "productVariants": [ { "id": "gid://shopify/ProductVariant/113711323", "contextualPricing": { "quantityPriceBreaks": { "nodes": [ { "minimumQuantity": 10, "price": { "amount": "35.0", "currencyCode": "USD" } } ] }, "quantityRule": { "minimum": 10, "maximum": 100, "increment": 5 } } } ], "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) { quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) { productVariants { id contextualPricing(context: {companyLocationId: $companyLocationId}) { quantityPriceBreaks(first: 1) { nodes { minimumQuantity price { amount currencyCode } } } quantityRule { minimum maximum increment } } } userErrors { message code field } } }\",\n \"variables\": {\n \"priceListId\": \"gid://shopify/PriceList/467640202\",\n \"companyLocationId\": \"gid://shopify/CompanyLocation/441870438\",\n \"input\": {\n \"quantityPriceBreaksToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"price\": {\n \"amount\": 35.0,\n \"currencyCode\": \"USD\"\n },\n \"minimumQuantity\": 5\n }\n ],\n \"quantityPriceBreaksToDelete\": [],\n \"quantityRulesToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"minimum\": 10,\n \"maximum\": 100,\n \"increment\": 5\n }\n ],\n \"quantityRulesToDeleteByVariantId\": [],\n \"pricesToAdd\": [\n {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"variantId\": \"gid://shopify/ProductVariant/113711323\"\n }\n ],\n \"pricesToDeleteByVariantId\": []\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) {\n quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) {\n productVariants {\n id\n contextualPricing(context: {companyLocationId: $companyLocationId}) {\n quantityPriceBreaks(first: 1) {\n nodes {\n minimumQuantity\n price {\n amount\n currencyCode\n }\n }\n }\n quantityRule {\n minimum\n maximum\n increment\n }\n }\n }\n userErrors {\n message\n code\n field\n }\n }\n }`,\n \"variables\": {\n \"priceListId\": \"gid://shopify/PriceList/467640202\",\n \"companyLocationId\": \"gid://shopify/CompanyLocation/441870438\",\n \"input\": {\n \"quantityPriceBreaksToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"price\": {\n \"amount\": 35.0,\n \"currencyCode\": \"USD\"\n },\n \"minimumQuantity\": 5\n }\n ],\n \"quantityPriceBreaksToDelete\": [],\n \"quantityRulesToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"minimum\": 10,\n \"maximum\": 100,\n \"increment\": 5\n }\n ],\n \"quantityRulesToDeleteByVariantId\": [],\n \"pricesToAdd\": [\n {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"variantId\": \"gid://shopify/ProductVariant/113711323\"\n }\n ],\n \"pricesToDeleteByVariantId\": []\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) {\n quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) {\n productVariants {\n id\n contextualPricing(context: {companyLocationId: $companyLocationId}) {\n quantityPriceBreaks(first: 1) {\n nodes {\n minimumQuantity\n price {\n amount\n currencyCode\n }\n }\n }\n quantityRule {\n minimum\n maximum\n increment\n }\n }\n }\n userErrors {\n message\n code\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"priceListId\": \"gid://shopify/PriceList/467640202\",\n \"companyLocationId\": \"gid://shopify/CompanyLocation/441870438\",\n \"input\": {\n \"quantityPriceBreaksToAdd\": [{\"variantId\"=>\"gid://shopify/ProductVariant/113711323\", \"price\"=>{\"amount\"=>35.0, \"currencyCode\"=>\"USD\"}, \"minimumQuantity\"=>5}],\n \"quantityPriceBreaksToDelete\": [],\n \"quantityRulesToAdd\": [{\"variantId\"=>\"gid://shopify/ProductVariant/113711323\", \"minimum\"=>10, \"maximum\"=>100, \"increment\"=>5}],\n \"quantityRulesToDeleteByVariantId\": [],\n \"pricesToAdd\": [{\"price\"=>{\"amount\"=>40.0, \"currencyCode\"=>\"USD\"}, \"variantId\"=>\"gid://shopify/ProductVariant/113711323\"}],\n \"pricesToDeleteByVariantId\": []\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) {\n quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) {\n productVariants {\n id\n contextualPricing(context: {companyLocationId: $companyLocationId}) {\n quantityPriceBreaks(first: 1) {\n nodes {\n minimumQuantity\n price {\n amount\n currencyCode\n }\n }\n }\n quantityRule {\n minimum\n maximum\n increment\n }\n }\n }\n userErrors {\n message\n code\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"priceListId\" => \"gid://shopify/PriceList/467640202\",\n \"companyLocationId\" => \"gid://shopify/CompanyLocation/441870438\",\n \"input\" => [\n \"quantityPriceBreaksToAdd\" => [{\"variantId\"=>\"gid://shopify/ProductVariant/113711323\", \"price\"=>{\"amount\"=>35.0, \"currencyCode\"=>\"USD\"}, \"minimumQuantity\"=>5}],\n \"quantityPriceBreaksToDelete\" => [],\n \"quantityRulesToAdd\" => [{\"variantId\"=>\"gid://shopify/ProductVariant/113711323\", \"minimum\"=>10, \"maximum\"=>100, \"increment\"=>5}],\n \"quantityRulesToDeleteByVariantId\" => [],\n \"pricesToAdd\" => [{\"price\"=>{\"amount\"=>40.0, \"currencyCode\"=>\"USD\"}, \"variantId\"=>\"gid://shopify/ProductVariant/113711323\"}],\n \"pricesToDeleteByVariantId\" => [],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) {\n quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) {\n productVariants {\n id\n contextualPricing(context: {companyLocationId: $companyLocationId}) {\n quantityPriceBreaks(first: 1) {\n nodes {\n minimumQuantity\n price {\n amount\n currencyCode\n }\n }\n }\n quantityRule {\n minimum\n maximum\n increment\n }\n }\n }\n userErrors {\n message\n code\n field\n }\n }\n }`,\n {\n variables: {\n \"priceListId\": \"gid://shopify/PriceList/467640202\",\n \"companyLocationId\": \"gid://shopify/CompanyLocation/441870438\",\n \"input\": {\n \"quantityPriceBreaksToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"price\": {\n \"amount\": 35.0,\n \"currencyCode\": \"USD\"\n },\n \"minimumQuantity\": 5\n }\n ],\n \"quantityPriceBreaksToDelete\": [],\n \"quantityRulesToAdd\": [\n {\n \"variantId\": \"gid://shopify/ProductVariant/113711323\",\n \"minimum\": 10,\n \"maximum\": 100,\n \"increment\": 5\n }\n ],\n \"quantityRulesToDeleteByVariantId\": [],\n \"pricesToAdd\": [\n {\n \"price\": {\n \"amount\": 40.0,\n \"currencyCode\": \"USD\"\n },\n \"variantId\": \"gid://shopify/ProductVariant/113711323\"\n }\n ],\n \"pricesToDeleteByVariantId\": []\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation quantityPricingByVariantUpdate($priceListId: ID!, $input: QuantityPricingByVariantUpdateInput!, $companyLocationId: ID!) {\n quantityPricingByVariantUpdate(priceListId: $priceListId, input: $input) {\n productVariants {\n id\n contextualPricing(context: {companyLocationId: $companyLocationId}) {\n quantityPriceBreaks(first: 1) {\n nodes {\n minimumQuantity\n price {\n amount\n currencyCode\n }\n }\n }\n quantityRule {\n minimum\n maximum\n increment\n }\n }\n }\n userErrors {\n message\n code\n field\n }\n }\n}"
input: { "priceListId": "gid://shopify/PriceList/467640202", "companyLocationId": "gid://shopify/CompanyLocation/441870438", "input": { "quantityPriceBreaksToAdd": [ { "variantId": "gid://shopify/ProductVariant/113711323", "price": { "amount": 35.0, "currencyCode": "USD" }, "minimumQuantity": 5 } ], "quantityPriceBreaksToDelete": [], "quantityRulesToAdd": [ { "variantId": "gid://shopify/ProductVariant/113711323", "minimum": 10, "maximum": 100, "increment": 5 } ], "quantityRulesToDeleteByVariantId": [], "pricesToAdd": [ { "price": { "amount": 40.0, "currencyCode": "USD" }, "variantId": "gid://shopify/ProductVariant/113711323" } ], "pricesToDeleteByVariantId": [] } }
response: { "data": { "quantityPricingByVariantUpdate": { "productVariants": null, "userErrors": [ { "message": "Miniumum quantity price break must be greater than or equal to the minimum quantity rule.", "code": "QUANTITY_PRICE_BREAK_ADD_MIN_LOWER_THAN_QUANTITY_RULES_MIN", "field": [ "input", "quantityPriceBreaksToAdd", "0" ] }, { "message": "Minimum quantity rule must be less than or equal to the minimum quantity price break.", "code": "QUANTITY_RULE_ADD_MIN_HIGHER_THAN_QUANTITY_PRICE_BREAK_MIN", "field": [ "input", "quantityRulesToAdd", "0" ] } ] } } }