quantityRulesDelete
Requires access scope. Also: The user must have permission to create and edit catalogs, and the shop requires B2B features enabled.
Deletes specific quantity rules from a price list using a product variant ID.
You can use the mutation to delete a set of quantity rules from a price list.
Arguments
- Anchor to priceListIdprice•
List Id ID!required The ID of the price list from which the quantity rules will be deleted.
- Anchor to variantIdsvariant•
Ids [ID!]!required A list of product variant IDs whose quantity rules will be removed from the price list.
Anchor to QuantityRulesDeletePayload returnsQuantityRulesDeletePayload returns
- Anchor to deletedQuantityRulesVariantIdsdeleted•
Quantity Rules Variant Ids A list of product variant IDs whose quantity rules were removed from the price list.
- Anchor to userErrorsuser•
Errors [QuantityRule non-nullUser Error!]! The list of errors that occurred from executing the mutation.
- Delete multiple quantity rules from a price list
- quantityRulesDelete reference
Examples
mutation quantityRulesDelete($priceListId: ID!, $variantIds: [ID!]!) {
quantityRulesDelete(priceListId: $priceListId, variantIds: $variantIds) {
deletedQuantityRulesVariantIds
userErrors {
field
code
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation quantityRulesDelete($priceListId: ID!, $variantIds: [ID!]!) { quantityRulesDelete(priceListId: $priceListId, variantIds: $variantIds) { deletedQuantityRulesVariantIds userErrors { field code message } } }",
"variables": {
"priceListId": "gid://shopify/PriceList/225060712",
"variantIds": [
"gid://shopify/ProductVariant/43729076",
"gid://shopify/ProductVariant/138327650"
]
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation quantityRulesDelete($priceListId: ID!, $variantIds: [ID!]!) {
quantityRulesDelete(priceListId: $priceListId, variantIds: $variantIds) {
deletedQuantityRulesVariantIds
userErrors {
field
code
message
}
}
}`,
{
variables: {
"priceListId": "gid://shopify/PriceList/225060712",
"variantIds": [
"gid://shopify/ProductVariant/43729076",
"gid://shopify/ProductVariant/138327650"
]
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation quantityRulesDelete($priceListId: ID!, $variantIds: [ID!]!) {
quantityRulesDelete(priceListId: $priceListId, variantIds: $variantIds) {
deletedQuantityRulesVariantIds
userErrors {
field
code
message
}
}
}`,
"variables": {
"priceListId": "gid://shopify/PriceList/225060712",
"variantIds": [
"gid://shopify/ProductVariant/43729076",
"gid://shopify/ProductVariant/138327650"
]
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation quantityRulesDelete($priceListId: ID!, $variantIds: [ID!]!) {
quantityRulesDelete(priceListId: $priceListId, variantIds: $variantIds) {
deletedQuantityRulesVariantIds
userErrors {
field
code
message
}
}
}
QUERY
variables = {
"priceListId": "gid://shopify/PriceList/225060712",
"variantIds": ["gid://shopify/ProductVariant/43729076", "gid://shopify/ProductVariant/138327650"]
}
response = client.query(query: query, variables: variables)