Welcome to our July 2021 API features designed to help you understand how you can implement all the latest changes to improve application quality and enhance your development experience.
This version includes the Bulk Mutations API, a new API that offers tremendous improvements to pushing large amounts of data into Shopify. Also released as part of 2021-07: Product Variant Bulk APIs, Files API, extended support for Storefront API meta fields, and improvements to international pricing.
The 2021-07 release includes many of the features announced in Shopify Unite this year. Many other announcements, especially improvements to the store experience, can be found in our section All Shopify Unite 2021 announcements send.
This release coincides with the removal of version 2020-04, so remember check your API report to make sure you are compatible and check for future changes. For a complete list of API changes related to this version, visit 2021-07 release notes.
Build apps for Shopify merchants
Whether you want to build apps for the Shopify App Store, provide custom app development services, or look for ways to grow your user base, the Shopify Partner Program will set you up for success. Join for free and use educational resources, developer preview environments, and recurring revenue sharing opportunities.
1. Metadata updates
Prior to this version, the use of meta fields in the store was possible, but also time consuming and inflexible. The only available store meta fields were product and product variant resources, and you had to create meta fields through the API and code them hard into themes.
The 2021-07 release includes major updates to meta fields that will greatly improve their applications for applications and merchants. Metafield’s store visibility is now supported in articles, blogs, collections, customers, subscriptions, websites and in-store resources.
metafieldStorefrontVisibilityCreate mutation to make metafield information for Storefront API clients. It has never been so easy to share relevant, flexible, and contextual information about each resource with the consumers of the Storefront API.
As shown on Shopify Unite, metafield definitions can now be created by their administrator, allowing merchants to create metafield templates that can be applied to their products. These definitions are also available to the API through the GraphQL API. This means that you can now create metafield definitions that appear in context as an administrator, allowing merchants to easily add structured metafield information to their products.
Here is an example of a request that creates a metafield definition to display as an administrator:
The resulting metafield configuration is displayed in the control as highlighted below.
These metafield definitions include the ability to perform validations 17 unique data types, by preparing them for display on all compatible topics. This is a huge extension to the metafield utility in marketplaces, and we can’t wait to see what you see with it.
Learn more about the changes announced as part of Online Store 2.0 Introducing Ecommerce 2.0: What It Means for Developers.
2. Mass mutation APIs
Last year, we released bulk APIs to help applications manage large data sets and prevent them from filling call boundaries to fully retrieve data. In this version, we release another related feature that dramatically improves the data processing experience for large stores: Bulk Mutation APIs. Bulk Mutation APIs eliminate the need to manage customer-side gas and allow applications to perform mutations asynchronously to bring huge amounts of data to Shopify stores.
Shopify’s API throttle normally works “leaking bucket” algorithm. The gas gives you a bucket of API calls that you can use immediately, but it takes 20 seconds for the bucket to fill completely if you empty it. This algorithm means that if you need to upgrade a few resources, it is usually better to operate synchronously.
You will notice something in the chart above. If you need to create more than 160 products through the API, using mass mutations is always faster. However, mass mutations are not limited to products. You can perform any mutation asynchronously. Because all Shopify resources use the same choke mechanism, you will see a similar trend in all creations or updates.
If we expand the timeline further, it’s very obvious that if you need to create or update many resources, the Bulk Operations API is always moving forward.
Bulk mutations are performed more than twice as fast as Synchronous GraphQL mutations and seven times faster than their REST equivalents. If you’re looking for ways to update or create Shopify resources faster, bulk mutations are the most effective way to interact with the API.
Learn more about Bulk Mutation APIs in our documents.
3. Bulk APIs for Product Options
Working with Variants Product the resource has traditionally had a few bears to try to avoid. In the past, an API customer’s intent was to infer from differences in the status of a Shopify product and your customers ’requests. Shopify expects that any API calls with variations will have an up-to-date copy of the transformation information. In previous API versions, the most common error in using the product API was the accidental removal of variants by pushing outdated product information.
Bulk product APIs include four new mutations that allow customers to explicitly define alternative behavior when pushing data in Shopify instead of the error-prone implicit model.
- productVariantsBulkCreate mutation allows you to create new variations for any product without having to include all existing variant information as part of your request.
- Using productVariantsBulkUpdate, you can update multiple variants explicitly and exclude variants that you do not update without fear of deleting them.
- productVariantsBulkDelete mutation allows you to specify a list of variations to remove from the product.
- productVariantsBulkReorder the mutation facilitates rearrangement of product variants in a single request.
Product Alternative Bulk APIs are the best way to safely, efficiently, and synchronously interact with product variant data without the risk of removing applications from outdated application data.
4. Files API
One of the features requested by the community, the Files API, is now available as part of version 2021-07.
stagedUploadCreate a mutation that previously only supported product media staging now allows for the incremental loading of other types of files. These phased files can now also be included as part of a file Create a mutation, which uploads the files to Shopify and adds them Files page With a Shopify administrator. Alternatively, you can enter an external URL
fileCreate download the file directly from a remote source to the administrator.
For example, the following mutation sends a file to the Files page:
Files are not limited to images. Price lists, PDF brochures, size guides, or other common files can also be downloaded using the File API.
5. International pricing
Prices displayed at the store may vary depending on the customer’s location. As seen on Shopify Unite, 2021-07 allows you to use the Storefront API to query international prices for products and orders and set the checkout context. This feature works together price listsand allows you to communicate international pricing in a contextual manner to buyers.
Queries that use context directive can use a country code argument that returns results for the selected country.
For example, a survey price ranges For Canadian products, you can use the following query with the inContext Directive:
This allows you to easily report prices that are relevant to the buyer instead of returning prices in the default trade currency.
Stay up to date with changes
Be sure to order all changes to the Shopify platform developer change log, the primary source of information for all new product launches. Stay up to date with the change log and stay ahead of the curve by introducing new features as soon as they are delivered to the upcoming 2021-10 release candidate.
You can also subscribe to monthly new information for partners and developers in the Shopify newsletter, which helps keep you up to date on all platform updates.