# Note The API for interacting with the note applied to checkout. ## StandardApi The base API object provided to `purchase` extension targets. ### Docs_Standard_NoteApi ### note value: `StatefulRemoteSubscribable` A note left by the customer to the merchant, either in their cart or during checkout. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## useNote Returns the proposed `note` applied to the checkout. ### UseNoteGeneratedType Returns the proposed `note` applied to the checkout. #### Returns: string | undefined export function useNote< Target extends RenderExtensionTarget = RenderExtensionTarget, >(): string | undefined { return useSubscription(useApi().note); } ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## CheckoutApi The API object provided to `purchase.checkout` extension targets. ### Docs_Checkout_NoteApi ### applyNoteChange value: `(change: NoteChange) => Promise` - NoteChange: NoteRemoveChange | NoteUpdateChange - NoteChangeResult: NoteChangeResultSuccess | NoteChangeResultError Performs an update on the note attached to the cart and checkout. If successful, this mutation results in an update to the value retrieved through the [`note`](https://shopify.dev/docs/api/checkout-ui-extensions/apis/note#standardapi-propertydetail-note) property. > Note: This method will return an error if the [cart instruction](https://shopify.dev/docs/api/checkout-ui-extensions/apis/cart-instructions#standardapi-propertydetail-instructions) `notes.canUpdateNote` is false, or the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay. ### NoteRemoveChange Removes a note ### type value: `"removeNote"` The type of the `NoteRemoveChange` API. ### NoteUpdateChange An Update to a note on the order. for example, the buyer could request detailed packaging instructions in an order note ### note value: `string` The new value of the note. ### type value: `"updateNote"` The type of the `NoteUpdateChange` API. ### NoteChangeResultSuccess ### type value: `"success"` The type of the `NoteChangeResultSuccess` API. ### NoteChangeResultError ### message value: `string` A message that explains the error. This message is useful for debugging. It is **not** localized, and therefore should not be presented directly to the buyer. ### type value: `"error"` The type of the `NoteChangeResultError` API. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## useApplyNoteChange Returns a function to mutate the `note` property of the checkout. ### UseApplyNoteChangeGeneratedType Returns a function to mutate the `note` property of the checkout. #### Returns: (change: NoteChange) => Promise export function useApplyNoteChange< Target extends RenderExtensionTarget = RenderExtensionTarget, >(): (change: NoteChange) => Promise { const api = useApi(); if ('applyNoteChange' in api) { return api.applyNoteChange; } throw new ExtensionHasNoMethodError('applyNoteChange', api.extension.target); } ### NoteRemoveChange Removes a note ### type value: `"removeNote"` The type of the `NoteRemoveChange` API. ### NoteUpdateChange An Update to a note on the order. for example, the buyer could request detailed packaging instructions in an order note ### note value: `string` The new value of the note. ### type value: `"updateNote"` The type of the `NoteUpdateChange` API. ### NoteChangeResultSuccess ### type value: `"success"` The type of the `NoteChangeResultSuccess` API. ### NoteChangeResultError ### message value: `string` A message that explains the error. This message is useful for debugging. It is **not** localized, and therefore should not be presented directly to the buyer. ### type value: `"error"` The type of the `NoteChangeResultError` API. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout)