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.
- 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
Anchor link to section titled "Breaking changes"These changes require special attention. If your app uses these API resources, and you don’t adjust your usage of the resources according to the following instructions, then your app might break when you update to this API version.
Next action for payment apps
Anchor link to section titled "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 andnil
specifies that no next action is required to complete the payment process.context
: Any data required to perform the action. Currently,context
can only bePaymentSessionActionsRedirect
.
GraphQL Admin API changes
Anchor link to section titled "GraphQL Admin API changes"Below are all the changes currently introduced in the 2021-04 version of the GraphQL Admin API.
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. 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 addedPaymentSessionNextAction
object was addedPaymentSessionNextActionAction
enum was addedPaymentSessionNextActionContext
union was added
Revenue attribution
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 addedAppRevenueAttributionRecordInput
input object was addedAppRevenueAttributionType
enum was addedrevenueAttributionRecords
connection was added to objectAppInstallation
New mutations
appRevenueAttributionRecordCreate
mutation was addedappRevenueAttributionRecordDelete
mutation was added
Discount codes
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 objectQueryRoot
discountRedeemCodeBulkCreation
field was added to objectQueryRoot
New types
DiscountRedeemCodeBulkCreationCode
object was addedDiscountRedeemCodeBulkCreation
object was addedDiscountRedeemCodeInput
input object was added
New mutations
discountRedeemCodeBulkAdd
mutation was added
Subscription policy
Apps can now read and write the subscription policy that merchants have configured for their store.
New value
SUBSCRIPTION_POLICY
value was added to enumShopPolicyType
Metafields
You can now query a metafield by ID from the query root of the GraphQL Admin API.
New field
metafield
field was added to objectQueryRoot
Script tag caching
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 objectScriptTag
cache
field was added to input objectScriptTagInput
Eligibility for international pricing
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 objectShopFeatures
internationalPriceOverrides
field was added to objectShopFeatures
Gift cards
As of API version 2021-04, you can manage gift cards using the GraphQL Admin API.
New types
giftCard
object was addedgiftCardCreateInput
input object was addedgiftCardUpdateInput
input object was addedgiftCards
connection was added toQueryRoot
giftCardUserError
type was added
New mutations
giftCardCreate
mutation was addedgiftCardUpdate
mutation was addedgiftCardDisable
mutation was added
New field
giftCardsCount
field was added to objectQueryRoot
Payment partner refunds
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 objectRefundSession
status
field was added to objectRefundSession
New mutations
refundSessionReject
mutation was addedrefundSessionResolve
mutation was added
External video support
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 byExternalVideo
object
New fields
host
field was added to objectExternalVideo
Contextual pricing
As of API version 2021-04, you 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 addedPriceListPriceOriginType
enum was addedPriceListParentUpdateInput
enum was addedPriceListParentCreateInput
object was addedPriceListPriceUserError
object was addedPriceListAdjustment
object was addedPriceListAdjustmentInput
object was addedPriceListParent
object was addedPriceListUpdateInput
object was addedPriceListCreateInput
object was addedPriceListUserError
object was addedPriceListPrice
object was addedPriceListPriceInput
object was addedPriceListContextRule
object was addedPriceListContextRuleInput
object was addedPriceListPriceOriginType
object was addedPriceList
object was added
New fields
price_list_price_active_bulk_import
field was added to objectQueryRoot
price_list
field was added to objectQueryRoot
price_lists
field was added to objectQueryRoot
New mutations
priceListCreate
mutation was addedpriceListDelete
mutation was addedpriceListFixedPricesAdd
mutation was addedpriceListFixedPricesDelete
mutation was addedpriceListUpdate
mutation was added
GraphQL Storefront API changes
Anchor link to section titled "GraphQL Storefront API changes"Below are all the changes currently introduced in the 2021-04 version of the GraphQL Storefront API.
Duties
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 objectCheckout
currentTotalDuties
field was added to objectOrder
originalTotalDuties
field was added to objectOrder
External video support
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 byExternalVideo
object.
New fields
host
field was added to objectExternalVideo
REST Admin API changes
Anchor link to section titled "REST Admin API changes"Below are all the changes currently introduced in the 2021-04 version of the REST Admin API.
Discounts applied to checkouts
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 toapplied_discounts
property on Checkout resourceapplication_type
property was added toline_items
property (within theapplied_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.
Delivery methods
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 resourceFulfillmentOrder
Discount codes
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.