API updates
Learn about the changes to the product-related elements in version 2024-04 of the GraphQL and REST Admin APIs.
New queries for variant and option resource limits
Anchor link to section titled "New queries for variant and option resource limits"To determine the total number of variants and options that can be added to each product in a shop, you can now query a shop’s product variants and options resource limits using ShopResourceLimits
:
Mutations for managing product options and variants
Anchor link to section titled "Mutations for managing product options and variants"New mutations to manage product options
Anchor link to section titled "New mutations to manage product options"We’ve added the following mutations to the GraphQL Admin API that enable you to manage product options directly:
Updated inputs to manage option values
Anchor link to section titled "Updated inputs to manage option values"To manage option values with the new product model, we've added an optionValues
field to the variants input on the following mutations in the GraphQL Admin API:
We've also added a productOptions
field to the input on the productCreate
mutation.
New mutation for syncing product data
Anchor link to section titled "New mutation for syncing product data"We've added the productSet
mutation to the GraphQL Admin API, to create and update the state of a product per an external database. The mutation is available to sync in both asynchronous and synchronous modes. It has a productOption
and a variants
input. The variants
input has an optionValues
input for pulling product and variant data from the external database.
Use this mutation when you're managing the state of the product model outside of Shopify, and want to update Shopify's product model state to reflect your external state. Examples are Enterprise Resource Planning (ERP) systems and Worksheets. The productSet
mutation has an input limit of 2K variants when run asynchronously and only 100 variants when run synchronously.
Deprecated GraphQL component fields
Anchor link to section titled "Deprecated GraphQL component fields"The following table lists deprecated fields and what you should use instead.
Component | Deprecated | Use instead |
---|---|---|
productCreate |
ProductInput.options field |
ProductInput.productOptions field |
productCreate |
ProductInput.variants field |
productVariantsBulkCreate |
productUpdate |
ProductInput.options field |
|
productUpdate |
ProductInput.variants field |
|
productVariantsBulkCreate |
variants.options field |
variants.optionValues field |
productVariantsBulkUpdate |
variants.options field |
variants.optionValues field |
ProductInput |
images field |
Learn more about managing media. |
Deprecated REST endpoints
Anchor link to section titled "Deprecated REST endpoints"The following REST endpoints and their operations are being deprecated:
products
products/{product-id}/variants
Learn more about addressing your use cases with the GraphQL Admin API's queries for retrieving data and mutations for adding and editing data.
Webhook updates
Anchor link to section titled "Webhook updates"A
variant_gids
field will be retroactively added to all webhook versions. The field will list all variant GIDs in the formatvariant_gids: [{admin_graphql_api_id: ID!}]
.Product webhooks will return a full variants payload for the first 100 records. For variants 101+, the payload won't include the full variant details, but the
variant_gids
field will still be included for these variants.
The following is an example payload: