Anchor to priceRuleDeleteprice
priceRuleDelete
mutationDeprecated
Requires access scope.
Delete a price rule. Use instead.
Anchor to PriceRuleDeletePayload returnsPriceRuleDeletePayload returns
- Anchor to deletedPriceRuleIddeleted•
Price Rule Id The ID price of the deleted price rule.
- Anchor to priceRuleUserErrorsprice•
Rule User Errors [PriceRule non-nullUser Error!]! The list of errors that occurred from executing the mutation.
- Anchor to shopshop•Shop!non-null
The shop of the deleted price rule.
- Anchor to userErrorsuser•
Errors The list of errors that occurred from executing the mutation.
Was this section helpful?
- Delete a price rule
- priceRuleDelete reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation priceRuleDelete($id: ID!) {
priceRuleDelete(id: $id) {
priceRuleUserErrors {
field
message
code
}
deletedPriceRuleId
}
}`,
{
variables: {
"id": "gid://shopify/PriceRule/1057371200"
},
},
);
const data = await response.json();
mutation priceRuleDelete($id: ID!) {
priceRuleDelete(id: $id) {
priceRuleUserErrors {
field
message
code
}
deletedPriceRuleId
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation priceRuleDelete($id: ID!) { priceRuleDelete(id: $id) { priceRuleUserErrors { field message code } deletedPriceRuleId } }",
"variables": {
"id": "gid://shopify/PriceRule/1057371200"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation priceRuleDelete($id: ID!) {
priceRuleDelete(id: $id) {
priceRuleUserErrors {
field
message
code
}
deletedPriceRuleId
}
}`,
{
variables: {
"id": "gid://shopify/PriceRule/1057371200"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation priceRuleDelete($id: ID!) {
priceRuleDelete(id: $id) {
priceRuleUserErrors {
field
message
code
}
deletedPriceRuleId
}
}`,
"variables": {
"id": "gid://shopify/PriceRule/1057371200"
},
},
});
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 priceRuleDelete($id: ID!) {
priceRuleDelete(id: $id) {
priceRuleUserErrors {
field
message
code
}
deletedPriceRuleId
}
}
QUERY
variables = {
"id": "gid://shopify/PriceRule/1057371200"
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"id": "gid://shopify/PriceRule/1057371200"
}
Response
JSON{
"priceRuleDelete": {
"priceRuleUserErrors": [],
"deletedPriceRuleId": "gid://shopify/PriceRule/1057371200"
}
}