Mutation QuantityPricingByVariantUpdate does not return Price Break IDs

It seems the mutation QuantityPricingByVariantUpdate does not return Price Break IDs which are later needed to delete specific price breaks from Shopify.

If we call the mutation with price breaks and do not receive price break IDs in the response, how are we supposed to delete some of those price breaks later?

Are are managing company prices, including prices breaks in Shopify through an integration with data from ERP systems. If a price break should be removed, then we’re not able to remove because we don’t have the necessary ID.

Hi Evaldas,

Would querying the contextualPricing field of the product variants after adding the price breaks work for you?

It would look something like:

query GetPriceBreaks($variantId: ID!, $companyLocationId: ID!) {
  productVariant(id: $variantId) {
    contextualPricing(context: {companyLocationId: $companyLocationId}) {
      quantityPriceBreaks(first: 10) {
        nodes {
          id
          minimumQuantity
          price {
            amount
            currencyCode
          }
        }
      }
    }
  }
}

You’d use the above query to fetch the id of the price breaks associated with the specific variant. Then you’d use the quantityPricingByVariantUpdate mutation to delete the price breaks by including their IDs in the quantityPriceBreaksToDelete input field.

1 Like

Hi Liam,

Thanks for reaching out.

I strongly believe that the mutation should return a list of effected price breaks as that would align with overall graphql mutation design that Shopify has been following. This is very strange and unexpected way of working with the API, even compared to other catalog and price list mutations.

Your specific example does not help. We are managing catalogs, catalog products, catalog price breaks and quantity rules. We are not in the context of a company location at all - it’s unintuitive and strange to suddenly need to query price breaks by a company location ID.

I would make 2 suggestions

  1. Enable ContextualPricing to instead accept a PriceListId (this is what the Admin page seems to be doing, but the API does not seem to match the public API that everyone else can use)
  2. Enable the QuantityPricingByVariantUpdate mutation to return affected price breaks.

Another reason why querying the price breaks separately is a bad idea, is because Shopify mutations sometimes have a tendency to not “find” data that has been created very recently due to indexing delays.

Managing catalogs, including their price breaks and quantity rules, must be reliable. None of the options available right now support this.

For now we will attempt to query the PriceList root object by ID (connected to the catalog) and then retrieve price breaks from there. Then we need to match those price breaks with price breaks we just sent to Shopify, hope that indexing has not been delayed and that we can manage this when working with 50,000 + items and their price breaks, quantity rules, etc.

The current mutations available to achieve this are quite disappointing :frowning:

One more point to this - querying by company location ID is not reliable because when managing catalogs there may not be a company location attached to the catalog yet. I.e. typically you will want to finish synchronizing prices to a catalog before attaching company locations to it to avoid those buyers placing orders with wrong prices.

Finally, managing catalog products, prices, price breaks and quantity rules does not otherwise require a reference to a company location whatsoever, so I really hope Shopify can resolve this workflow inconsistency.

:pray: :heart: