Shopify API Release: October 2020

Shopify API release October 2020

Welcome to the October 2020 edition of our API features roundup, designed to help you understand how all the changes of our latest API release can be adopted to improve the quality of your apps and your development experience.

This month, there were a ton of additions to the API: asset checksums, discount enhancements, legal policy APIs, and draft products all contributed to this release. The 2020-10 launch also coincides with the removal of version 2019-10, so remember tocheck your API health reportto make sure that you're compatible.

Released as part of 2020-10

Here are the features included in the 2020-10 release.

1. Asset checksums

In the past, syncing local theme files to an online store has presented some challenges. Without a way to programmatically understand which local files are different from live ones, the only option was to push up every local file. With the release of 2020-10, checksums have been added to theme files, enabling selective updates that only include necessary requests.

In older versions ofShopify Theme Kit, your local machine deploys every file to the storefront. For larger themes, this could take several minutes. Using checksums included in the 2020-10 version of the Assets API reduces deploy times to near-instant.

Shopify API release October 2020: deploying files without checksum
主题包部署主题文件没有校验和。This barebones theme takes more than 15 seconds to upload.
Shopify API release October 2020: deploying with theme kit version 1.10+
Theme Kit version 1.10+ only uploads the files that have been edited since the last deployment, resulting in much faster uploads. After editing three files, the same theme takes less than one second to deploy.

Here’s a breakdown of how checksums affects theme uploads with different numbers of files, after 10 files have been edited:

Theme with 25 files

Theme with 100 files

Theme with 250 files

No Checksums

15 seconds

60 seconds

150 seconds

Checksums

Three seconds

Three seconds

Three seconds


Learn morein the docsor in our recent blog post onchecksums.

2. Discount enhancements

In this version, discounts have received some new fields, mutations, arguments, and types to extend and enhance their functionality. Using the GraphQL Admin API, it’s now possible to retrieve usage counts for automatic discounts, search through discounts, and even perform bulk mutations, significantly reducing the number of calls required to manage discounts.

For example: In the past, if you wanted to delete 10 discount codes, you would need to execute 10 mutations, one for each discount ID. Even though you could run all of these mutations in a single transaction, they were still a significant hit against the API call limit.

现在,一个查询将允许您删除所有10 discount codes:

Bulk queries allow you to activate, deactivate, or delete automatic and basic discount codes in bulk. Bulk queries reduce the number of requests required to manage large numbers of discount codes by orders of magnitude, freeing up more of your API call limit for other essential functions.

Learn more about managing your discounts in bulk in ourdeveloper documentation.

You might also like:API Deprecation at Shopify: 2020-10 Edition.

3. Add discounts to items while editing orders

Orders edited through the GraphQL Admin API can now include manual or percentage-based discounts to any item added while editing an order. Adding discounts during edits is entirely new functionality and is available exclusively through GraphQL.

Below is an example of a mutation to add a discount to a line item during an order edit.

For more example mutations and additional instructions about editing orders, refer to ourdocumentation.

In the past several years, governments worldwide have established a wide variety of legal guidelines and recommendations to protect owners of online businesses and the people who shop with them. These requirements often need to be surfaced through a store's terms of service, privacy policy, or refund policy.

在以前的版本中,这些法律政策ly been editable through the Shopify Admin's Settings page. As of 2020-10, these legal policies are accessible through the GraphQL Admin API, allowing apps to help merchants manage all aspects of their legal policies.

The request below forshopPolicieswill yield the type and content of the store’s legal policies:

An accompanying mutation will allow you to modify these legal policies, which is especially helpful if you want to help store owners in specific geographies be compliant with their local government regulations. To learn more about theshopPolicyUpdatemutation, visit ourdeveloper documentation.

5. Draft products

As of 2020-10, thestatusfield is now available on both REST and GraphQL Product APIs. This field can identify, filter, and manage products based on their product status: draft, active, or archived.

You can create products in a draft status, work on them iteratively, and then make them available to the relevant sales channels with an “active” status when they’re ready to go. Archiving products is a great way to keep a product list organized and free of clutter without worrying about losing product information.

Below, you’ll find an example of a query to fetch products in the “draft” state.

For more information on product states, including the accompanying mutations to change a product’s state to active, archived, or draft, visit our guide onusing statuses to identify, filter, and manage products.

You might also like:The 20 Best Brackets Extensions for Front End Developers.

Stay on top of changes

For all Shopify platform changes, make sure to subscribe to theDeveloper Changelog, the primary source of information for all new product launches. Stay up to date using the changelog, and stay ahead of the curve by adopting new features as soon as they’re shipped into the upcoming 2021-01 release candidate.

For more information, you can also subscribe to What’s New for Shopify Partners, our monthly product email, below.

Template Icon
Topics:

Grow your business with the Shopify Partner Program

Learn more