Cart InstructionsAPI
Instructions used to create the checkout.
Anchor to standardapiStandardApi
The base API object provided to purchase
extension targets.
The cart instructions used to create the checkout and possibly limit extension capabilities.
These instructions should be checked prior to performing any actions that may be affected by them.
For example, if you intend to add a discount code via the method, check
to ensure it's supported in this checkout.
As of version 2024-07
, UI extension code must check for instructions before calling select APIs in case those APIs are not available. See the update guide for more information.
Anchor to useInstructionsuse Instructions()
Returns the cart instructions used to create the checkout and possibly limit extension capabilities.
CartInstructions
Cart instructions related to cart attributes.
Cart instructions related to delivery.
Cart instructions related to discounts.
Cart instructions related to cart lines.
Cart instructions related to metafields.
Cart instructions related to notes.
Discounts
Anchor to examplesExamples
Use the cart instructions API to determine if the affected APIs are available in checkout.
Anchor to example-attributesAttributes
Check before calling
.
Anchor to example-deliveryDelivery
Check before calling
. When
true
, this instruction implies that extensions can change the shipping address.
Anchor to example-discountsDiscounts
Check before calling
.
Check or
or
before calling
.
Anchor to example-metafieldsMetafields
Check or
before calling
if you are working with cart metafields.
Check before calling
.