Welcome to the April 2021 edition of our API features roundup, designed to help you understand how you can adopt all the latest changes to improve the quality of your apps and streamline your development experience.
This version includes the Price List API, which provides huge improvements to pricing control in international markets. Also released as a part of 2021-04: bulk discount code management with GraphQL and duties information on the Storefront API.
The 2021-04 launch also coincides with the removal of version 2020-04, so remember tocheck your API health reportto make sure you're compatible and review the changes coming.
Build apps for Shopify merchants
Whether you want to build apps for the Shopify App Store, offer custom app development services, or are looking for ways to grow your user base, the Shopify Partner Program will set you up for success. Join for free and access educational resources, developer preview environments, and recurring revenue share opportunities.
Sign up1. Price List API
In this version, international pricing control has never been better with the addition of the Price List API. The Price List API allows you to create a set of rules that change products' prices based on specific "context rules" about the customer's location. If a Price list exists for the product and geography the customer is ordering from, the storefront will charge a different price based on those rules.
See an example mutation to create a price list for discounted Canadian prices:
Price lists support fixed prices or relative adjusted prices and can be applied to any country in the world. Prices can be increased or decreased, and are then applied automatically in the欧宝体育官网入口首页and during checkout with no additional work from the merchant or code that needs to be inserted by the app.
In the example above, a Canadian customer is trying to buy a sweater from a store based in the US. Without a price list, the default behavior would be to apply a FX rate, apply rounding, and then display that price to the customer. Price lists allow the store to instead apply a specific fixed price (ex. $35.00 CAD), or apply a preconfigured adjusted relative price.
Price lists give much finer-grained control over product pricing, and are all controllable through the API. For more information on how to use price lists, refer to ourtutorial on supporting different pricing models through the Price List API.
2. Duties through the Storefront API
As of the 2021-04 version, Shopify will return information about duties through the Storefront API. This change means there will be some changes to the meaning of some of the order and checkout resources to support this new functionality. Some summed totals will include duties, and others won't. A good guiding principle: if it was a calculated value that included taxes before, now it also includes duties.
Totals that don’t include duties:
- Checkout.lineItemsSubtotalPrice
- Checkout.subtotalPriceV2
- Order.currentSubtotalPrice
- Order.subtotalPriceV2
Totals that do include duties:
- Checkout.paymentDueV2
- Checkout.totalPriceV2
- Order.currentTotalPrice
- Order.totalPriceV2
For more information on the addition of Duties to the storefront API, visitour post on the Developer Changelog.
3. Discount Code API improvements
As of version 2021-04, we've made some changes to how apps can manage discount codes with GraphQL. When managing discounts, it's now possible to add redeemable discount codes in bulk rather than make individual queries to update discount codes associated with a given Price Rule.
An example mutation:
Variables:
A mutation nameddiscountCodeCount
has also been added, allowing you to count the number of discount codes associated with a given shop. Apps that had been previously using REST to take advantage of bulk code creation or the count endpoint can now use GraphQL, and benefit from the added throttle throughput along with these new mutations.
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-07 release candidate.
You can also subscribe to our monthly What’s New for Partners and Developers at Shopify newsletter, which will help keep you on top of all platform updates:
Stay in the know
订阅接收Shopify有什么新的,我们monthly email featuring Shopify's latest product news.