Re: available_for_sale field is not present in product/update webhook for variants

available_for_sale field is not present in product/update webhook for variants

neeraj-local
Shopify Partner
2 0 0

Some merchants use third-party inventory management services, and not all of them allow Shopify to track inventory.

 

In such cases, the inventory_policy is set to deny by default and inventory_quantity appears as 0, even though the third-party system may have sufficient stock. This makes it difficult to accurately determine the actual availability of a variant.

 

Additionally, the product/update webhook does not currently include the available_for_sale field at the variant level. Relying on a separate GraphQL query for every product update is resource-intensive and inefficient.

 

Would it be possible to include the available_for_sale field for variants in the product/update webhook? This would significantly improve our ability to track product availability accurately and reduce the need for costly API calls.

Replies 3 (3)

Small_Task_Help
Shopify Partner
1106 51 108

Hi,

Hope this will help

Set a cron job to pull variant data every few minutes/hours via GraphQL Admin API:

Code example

{
  product(id: "gid://shopify/Product/123456789") {
    variants(first: 10) {
      edges {
        node {
          id
          title
          availableForSale
        }
      }
    }
  }
}
To Get Shopify Experts Help, Click Here or E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert India
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad
neeraj-local
Shopify Partner
2 0 0

As mentioned earlier, relying on separate GraphQL queries is both resource-intensive and inefficient. This information is only required when a product is updated or an order is placed.
Including the available_for_sale field directly in the webhook payload would be a much more efficient and scalable solution.

richardcobain
Trailblazer
160 7 22

It would indeed be beneficial for the product/update webhook to include the available_for_sale field at the variant level to streamline inventory tracking and reduce unnecessary API calls. Currently, this field is not included, and it can be resource-intensive to make separate queries to check product availability. You may want to submit a feature request to Shopify through their official support or development channels, as this would improve efficiency for merchants using third-party inventory systems