2021-04 release notes

Release date Date version is no longer supported
April 1, 2021 April 1, 2022

The 2021-04 release contains support for building custom price cards for individual product variants, managing gift cards, and creating discount codes in bulk using the GraphQL Admin API.

This release also includes support for duties in the Storefront API and the ability to retrieve information about discounts applied to a checkout using the REST Admin API.

What’s new in 2021-04

The following features were added in version 2021-04 of Shopify's APIs:

  • Using the Price List API, you can now change the prices of products 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, then the storefront will charge a different price based on those rules.
  • Using the GiftCard API, you can now create, retrieve, update, and disable gift cards for a store. To learn more about managing gift cards, refer to Manage gift cards with the GraphQL Admin API.
  • 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.
  • Shopify now returns information about duties through the Storefront API. You can query the total duties applied to line items in the checkout and the total current and original duties applied to an order.
  • Using the Checkout resource, you can now retrieve information about how a discount was applied to a checkout.

Breaking changes

These changes require special attention. If your app uses these API resources and you don’t upgrade to a more recent API version, then your app will break.

Next action for payment apps

As of API version 2021-04, payment apps that use the redirectUrl field on PaymentSession must update their apps to use the nextAction field.

Previously, payment apps that were processing a payment needed to use the redirectUrl field to redirect the customer after they completed their payment offsite. This redirectUrl field was specific to offsite payments only.

To support payment methods other than offsite, and other actions that might need to occur depending on the type of payment, we've added the following fields on PaymentSessionNextAction:

  • action: The action that the payment app must perform. REDIRECT indicates the need to redirect the customer after they've completed their payment and nil specifies that no next action is required to complete the payment process.
  • context: Any data required to perform the action. Currently, context can only be PaymentSessionActionsRedirect.

GraphQL Admin API changes

Below are all the changes currently introduced in the 2021-04 version of the GraphQL Admin API.

As of API version 2021-04, payment apps that use the redirectUrl field on PaymentSession must update their apps to use the nextAction field. This allows payment apps to support payment methods other than offsite and other actions that might need to occur depending on the type of payment.

New types

  • PaymentSessionActionsRedirect object was added
  • PaymentSessionNextAction object was added
  • PaymentSessionNextActionAction enum was added
  • PaymentSessionNextActionContext union was added

If you run ads on the Shopify App Store, have a valid billing exemption, and want to attribute revenue generated outside of the Billing API to your ad campaigns, then you can use the Ad Conversion API to capture the details of externally collected revenue.

New types

  • AppRevenueAttributionRecord object was added
  • AppRevenueAttributionRecordInput input object was added
  • AppRevenueAttributionType enum was added
  • revenueAttributionRecords connection was added to object AppInstallation

New mutations

  • appRevenueAttributionRecordCreate mutation was added
  • appRevenueAttributionRecordDelete mutation was added

As of API version 2021-04, you can query the discountCodeCount field on QueryRoot to retrieve a count of discount codes for a shop. You can also asynchronously add discount redeem codes in bulk using the GraphQL Admin API.

New fields

  • discountCodeCount field was added to object QueryRoot
  • discountRedeemCodeBulkCreation field was added to object QueryRoot

New types

  • DiscountRedeemCodeBulkCreationCode object was added
  • DiscountRedeemCodeBulkCreation object was added
  • DiscountRedeemCodeInput input object was added

New mutations

  • discountRedeemCodeBulkAdd mutation was added

Apps can now read and write the subscription policy that merchants have configured for their store.

New value

  • SUBSCRIPTION_POLICY value was added to enum ShopPolicyType

You can now query a metafield by ID from the query root of the GraphQL Admin API.

New field

  • metafield field was added to object QueryRoot

As of API version 2021-04, you can query the ScriptTag object to determine whether the Shopify CDN (content delivery network) can cache and serve a script tag.

New field

  • cache field was added to object ScriptTag
  • cache field was added to input object ScriptTagInput

As of API version 2021-04, you can query the ShopFeatures object to determine whether a shop can enable international price rules and price overrides.

New field

  • internationalPriceRules field was added to object ShopFeatures
  • internationalPriceOverrides field was added to object ShopFeatures

As of API version 2021-04, you can manage gift cards using the GraphQL Admin API.

New types

  • giftCard object was added
  • giftCardCreateInput input object was added
  • giftCardUpdateInput input object was added
  • giftCards connection was added to QueryRoot
  • giftCardUserError type was added

New mutations

  • giftCardCreate mutation was added
  • giftCardUpdate mutation was added
  • giftCardDisable mutation was added

As of API version 2021-04, you can use RefundSession to issue refunds against payments that have been processed by Payments Partner gateways.

New types

  • RefundSession object was added

New fields

  • id field was added to object RefundSession
  • status field was added to object RefundSession

New mutations

  • refundSessionReject mutation was added
  • refundSessionResolve mutation was added

As of API version 2021-04, you can query for video hosted outside of Shopify and filter by the value of host.

New types

  • MediaHost enum was added and is returned by ExternalVideo object

New fields

  • host field was added to object ExternalVideo

As of API version 2021-04, you can can use price lists to specify either fixed prices or adjusted relative prices that override initial product variant prices. Refer to Support different pricing models using the price list API for more information.

New types

  • PriceListAdjustmentType enum was added
  • PriceListPriceOriginType enum was added
  • PriceListParentUpdateInput enum was added
  • PriceListParentCreateInput object was added
  • PriceListPriceUserError object was added
  • PriceListAdjustment object was added
  • PriceListAdjustmentInput object was added
  • PriceListParent object was added
  • PriceListUpdateInput object was added
  • PriceListCreateInput object was added
  • PriceListUserError object was added
  • PriceListPrice object was added
  • PriceListPriceInput object was added
  • PriceListContextRule object was added
  • PriceListContextRuleInput object was added
  • PriceListPriceOriginType object was added
  • PriceList object was added

New fields

  • price_list_price_active_bulk_import field was added to object QueryRoot
  • price_list field was added to object QueryRoot
  • price_lists field was added to object QueryRoot

New mutations

  • priceListCreate mutation was added
  • priceListDelete mutation was added
  • priceListFixedPricesAdd mutation was added
  • priceListFixedPricesDelete mutation was added
  • priceListUpdate mutation was added

GraphQL Storefront API changes

Below are all the changes currently introduced in the 2021-04 version of the GraphQL Storefront API.

As of API version 2021-04, you can query the total duties applied to line items in the checkout and the total current and original duties applied to an order.

New fields

  • totalDuties field was added to object Checkout
  • currentTotalDuties field was added to object Order
  • originalTotalDuties field was added to object Order

As of API version 2021-04, you can query for video hosted outside of Shopify and filter by the value of host.

New types

  • MediaHost enum was added and is returned by ExternalVideo object.

New fields

  • host field was added to object ExternalVideo

REST Admin API changes

Below are all the changes currently introduced in the 2021-04 version of the REST Admin API.

As of API version 2021-04, you can use the Checkout resource to retrieve information about how a discount was applied to a checkout.

New property

  • application_type property was added to applied_discounts property on Checkout resource
  • application_type property was added to line_items property (within the applied_discounts property) on Checkout resource

Possible values for application_type include:

  • automatic: The discount was applied automatically.
  • discount_code: The merchant or customer entered a discount code.
  • manual: The discount was applied manually by the merchant or an app.
  • script: The discount was applied by a Shopify Script.

As of API version 2021-04, you can use the FulfillmentOrder resource to retrieve the type of method used to transfer a product or service to a customer.

New property

  • delivery_method property was added to resource FulfillmentOrder

As of API version 2021-04, you can use the DiscountCode resource to retrieve a count of discount codes for a shop.

New endpoint

  • /admin/api/2021-04/discount_codes/count.json: Retrieves a count of discount codes for a shop.