Anchor to section titled 'undefined'

quantityRulesDelete
mutation

Requires write_products access scope. Also: The user must have a permission to delete quantity rules from a price list.

Deletes specific quantity rules from a price list using a product variant ID. You can use the quantityRulesDelete mutation to delete a set of quantity rules from a price list.


Anchor to priceListId
priceListId
required

The ID of the price list from which the quantity rules will be deleted.

Anchor to variantIds
variantIds
required

A list of product variant IDs whose quantity rules will be removed from the price list.


Was this section helpful?

A list of product variant IDs whose quantity rules were removed from the price list.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
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-01/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();
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)
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"
      ]
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$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]);
Hide code
Input variables
Copy
{
  "priceListId": "gid://shopify/PriceList/225060712",
  "variantIds": [
    "gid://shopify/ProductVariant/43729076",
    "gid://shopify/ProductVariant/138327650"
  ]
}
Hide code
Response
JSON
{
  "quantityRulesDelete": {
    "deletedQuantityRulesVariantIds": [
      "gid://shopify/ProductVariant/43729076",
      "gid://shopify/ProductVariant/138327650"
    ],
    "userErrors": []
  }
}