--- title: CartWarning - Storefront API description: > A non-blocking issue that occurred during a cart mutation. Unlike errors, warnings don't prevent the mutation from completing but indicate potential problems that may affect the buyer's experience. Each warning includes a code identifying the issue type, a human-readable message, and a target ID pointing to the affected resource. api_version: unstable api_name: storefront source_url: html: 'https://shopify.dev/docs/api/storefront/unstable/objects/CartWarning' md: 'https://shopify.dev/docs/api/storefront/unstable/objects/CartWarning.md' --- # Cart​Warning object A non-blocking issue that occurred during a cart mutation. Unlike errors, warnings don't prevent the mutation from completing but indicate potential problems that may affect the buyer's experience. Each warning includes a code identifying the issue type, a human-readable message, and a target ID pointing to the affected resource. ## Fields * code [Cart​Warning​Code!](https://shopify.dev/docs/api/storefront/unstable/enums/CartWarningCode) non-null The code of the warning. * message [String!](https://shopify.dev/docs/api/storefront/unstable/scalars/String) non-null The message text of the warning. * target [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) non-null The target of the warning. *** ## Map No referencing types *** ## Mutations * [cart​Attributes​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartAttributesUpdate) mutation Updates the attributes on a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart). Attributes are custom key-value pairs that store additional information, such as gift messages, special instructions, or order notes. * attributes [\[Attribute​Input!\]!](https://shopify.dev/docs/api/storefront/unstable/input-objects/AttributeInput) required ### Arguments An array of key-value pairs that contains additional information about the cart. The input must not contain more than `250` values. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required The ID of the cart. *** * [cart​Buyer​Identity​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartBuyerIdentityUpdate) mutation Updates the buyer identity on a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart), including contact information, location, and checkout preferences. The buyer's country determines [international pricing](https://shopify.dev/docs/storefronts/headless/building-with-the-storefront-api/markets/international-pricing) and should match their shipping address. Use this mutation to associate a logged-in customer via access token, set a B2B company location, or configure checkout preferences like delivery method. Preferences prefill checkout fields but don't sync back to the cart if overwritten at checkout. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * buyer​Identity [Cart​Buyer​Identity​Input!](https://shopify.dev/docs/api/storefront/unstable/input-objects/CartBuyerIdentityInput) required The customer associated with the cart. Used to determine [international pricing](https://shopify.dev/custom-storefronts/internationalization/international-pricing). Buyer identity should match the customer's shipping address. *** * [cart​Create](https://shopify.dev/docs/api/storefront/unstable/mutations/cartCreate) mutation Creates a new [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart) for a buyer session. You can optionally initialize the cart with merchandise lines, discount codes, gift card codes, buyer identity for international pricing, and custom attributes. The returned cart includes a `checkoutUrl` that directs the buyer to complete their purchase. * input [Cart​Input](https://shopify.dev/docs/api/storefront/unstable/input-objects/CartInput) ### Arguments The fields used to create a cart. *** * [cart​Delivery​Addresses​Add](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDeliveryAddressesAdd) mutation Adds delivery addresses to a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart). A cart can have up to 20 delivery addresses. One address can be marked as selected for checkout, and addresses can optionally be marked as one-time use so they aren't saved to the customer's account. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * addresses [\[Cart​Selectable​Address​Input!\]!](https://shopify.dev/docs/api/storefront/unstable/input-objects/CartSelectableAddressInput) required A list of delivery addresses to add to the cart. The input must not contain more than `250` values. *** * [cart​Delivery​Addresses​Remove](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDeliveryAddressesRemove) mutation Removes delivery addresses from a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart) by their IDs, allowing batch removal in a single request. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * address​Ids [\[ID!\]!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required A list of delivery addresses by handle to remove from the cart. The input must not contain more than `250` values. *** * [cart​Delivery​Addresses​Replace](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDeliveryAddressesReplace) mutation Replaces all delivery addresses on a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart) with a new set of addresses in a single operation. Unlike [`cartDeliveryAddressesUpdate`](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDeliveryAddressesUpdate), which modifies existing addresses, this mutation removes all current addresses and sets the provided list as the new delivery addresses. One address can be marked as selected, and each address can be flagged for one-time use or configured with a specific validation strategy. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * addresses [\[Cart​Selectable​Address​Input!\]!](https://shopify.dev/docs/api/storefront/unstable/input-objects/CartSelectableAddressInput) required A list of delivery addresses to replace on the cart. The input must not contain more than `250` values. *** * [cart​Delivery​Addresses​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDeliveryAddressesUpdate) mutation Updates one or more delivery addresses on a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart). Each address can be modified to change its details, set it as the pre-selected address for checkout, or mark it for one-time use so it isn't saved to the customer's account. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * addresses [\[Cart​Selectable​Address​Update​Input!\]!](https://shopify.dev/docs/api/storefront/unstable/input-objects/CartSelectableAddressUpdateInput) required The delivery addresses to update. The input must not contain more than `250` values. *** * [cart​Discount​Codes​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDiscountCodesUpdate) mutation Updates the discount codes applied to a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart). This mutation replaces all existing discount codes with the provided list, so pass an empty array to remove all codes. Discount codes are case-insensitive. After updating, check each [`CartDiscountCode`](https://shopify.dev/docs/api/storefront/unstable/objects/CartDiscountCode) in the cart's [`discountCodes`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart#field-Cart.fields.discountCodes) field to see whether the code is applicable to the cart's current contents. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * discount​Codes [\[String!\]!](https://shopify.dev/docs/api/storefront/unstable/scalars/String) required The case-insensitive discount codes that the customer added at checkout. The input must not contain more than `250` values. *** * [cart​Gift​Card​Codes​Add](https://shopify.dev/docs/api/storefront/unstable/mutations/cartGiftCardCodesAdd) mutation Adds gift card codes to a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart) without replacing any codes already applied. Gift card codes are case-insensitive. To replace all gift card codes instead of adding to them, use [`cartGiftCardCodesUpdate`](https://shopify.dev/docs/api/storefront/unstable/mutations/cartGiftCardCodesUpdate). * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * gift​Card​Codes [\[String!\]!](https://shopify.dev/docs/api/storefront/unstable/scalars/String) required The case-insensitive gift card codes to add. The input must not contain more than `250` values. *** * [cart​Gift​Card​Codes​Remove](https://shopify.dev/docs/api/storefront/unstable/mutations/cartGiftCardCodesRemove) mutation Removes gift cards from a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart) using their IDs. You can retrieve the IDs of applied gift cards from the cart's [`appliedGiftCards`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart#field-Cart.fields.appliedGiftCards) field. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * applied​Gift​Card​Ids [\[ID!\]!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required The gift cards to remove. The input must not contain more than `250` values. *** * [cart​Gift​Card​Codes​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartGiftCardCodesUpdate) mutation Updates the gift card codes applied to the cart. Unlike [`cartGiftCardCodesAdd`](https://shopify.dev/docs/api/storefront/unstable/mutations/cartGiftCardCodesAdd), which adds codes without replacing existing ones, this mutation sets the gift card codes for the cart. Gift card codes are case-insensitive. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * gift​Card​Codes [\[String!\]!](https://shopify.dev/docs/api/storefront/unstable/scalars/String) required The case-insensitive gift card codes. The input must not contain more than `250` values. *** * [cart​Lines​Add](https://shopify.dev/docs/api/storefront/unstable/mutations/cartLinesAdd) mutation Adds one or more merchandise lines to an existing [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart). Each line specifies the [product variant](https://shopify.dev/docs/api/storefront/unstable/objects/ProductVariant) to purchase. Quantity defaults to `1` if not provided. You can add up to 250 lines in a single request. Use [`CartLineInput`](https://shopify.dev/docs/api/storefront/unstable/input-objects/CartLineInput) to configure each line's merchandise, quantity, selling plan, custom attributes, and any parent relationships for nested line items such as warranties or add-ons. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * lines [\[Cart​Line​Input!\]!](https://shopify.dev/docs/api/storefront/unstable/input-objects/CartLineInput) required A list of merchandise lines to add to the cart. The input must not contain more than `250` values. *** * [cart​Lines​Remove](https://shopify.dev/docs/api/storefront/unstable/mutations/cartLinesRemove) mutation Removes one or more merchandise lines from a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart). Accepts up to 250 line IDs per request. Returns the updated cart along with any errors or warnings. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * line​Ids [\[ID!\]!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required The merchandise line IDs to remove. The input must not contain more than `250` values. *** * [cart​Lines​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartLinesUpdate) mutation Updates one or more merchandise lines on a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart). You can modify the quantity, swap the merchandise, change custom attributes, or update the selling plan for each line. You can update a maximum of 250 lines per request. Omitting the [`attributes`](https://shopify.dev/docs/api/storefront/unstable/mutations/cartLinesUpdate#arguments-lines.fields.attributes) field or setting it to null preserves existing line attributes. Pass an empty array to clear all attributes from a line. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * lines [\[Cart​Line​Update​Input!\]!](https://shopify.dev/docs/api/storefront/unstable/input-objects/CartLineUpdateInput) required The merchandise lines to update. The input must not contain more than `250` values. *** * [cart​Note​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartNoteUpdate) mutation Updates the note on a [`Cart`](https://shopify.dev/docs/api/storefront/unstable/objects/Cart). The note is a text field that stores additional information, such as a personalized message from the buyer or special instructions for the order. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * note [String!](https://shopify.dev/docs/api/storefront/unstable/scalars/String) required The note on the cart. *** * [cart​Selected​Delivery​Options​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartSelectedDeliveryOptionsUpdate) mutation Updates the selected delivery option for one or more [`CartDeliveryGroup`](https://shopify.dev/docs/api/storefront/unstable/objects/CartDeliveryGroup) objects in a cart. Each delivery group represents items shipping to a specific address and offers multiple delivery options with different costs and methods. Use this mutation when a customer chooses their preferred shipping method during checkout. The [`deliveryOptionHandle`](https://shopify.dev/docs/api/storefront/unstable/input-objects/CartSelectedDeliveryOptionInput#field-CartSelectedDeliveryOptionInput.fields.deliveryOptionHandle) identifies which [`CartDeliveryOption`](https://shopify.dev/docs/api/storefront/unstable/objects/CartDeliveryOption) to select for each delivery group. * cart​Id [ID!](https://shopify.dev/docs/api/storefront/unstable/scalars/ID) required ### Arguments The ID of the cart. * selected​Delivery​Options [\[Cart​Selected​Delivery​Option​Input!\]!](https://shopify.dev/docs/api/storefront/unstable/input-objects/CartSelectedDeliveryOptionInput) required The selected delivery options. The input must not contain more than `250` values. *** *** ## CartWarning Mutations ### Mutated by * [cart​Attributes​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartAttributesUpdate) * [cart​Buyer​Identity​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartBuyerIdentityUpdate) * [cart​Create](https://shopify.dev/docs/api/storefront/unstable/mutations/cartCreate) * [cart​Delivery​Addresses​Add](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDeliveryAddressesAdd) * [cart​Delivery​Addresses​Remove](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDeliveryAddressesRemove) * [cart​Delivery​Addresses​Replace](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDeliveryAddressesReplace) * [cart​Delivery​Addresses​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDeliveryAddressesUpdate) * [cart​Discount​Codes​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartDiscountCodesUpdate) * [cart​Gift​Card​Codes​Add](https://shopify.dev/docs/api/storefront/unstable/mutations/cartGiftCardCodesAdd) * [cart​Gift​Card​Codes​Remove](https://shopify.dev/docs/api/storefront/unstable/mutations/cartGiftCardCodesRemove) * [cart​Gift​Card​Codes​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartGiftCardCodesUpdate) * [cart​Lines​Add](https://shopify.dev/docs/api/storefront/unstable/mutations/cartLinesAdd) * [cart​Lines​Remove](https://shopify.dev/docs/api/storefront/unstable/mutations/cartLinesRemove) * [cart​Lines​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartLinesUpdate) * [cart​Note​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartNoteUpdate) * [cart​Selected​Delivery​Options​Update](https://shopify.dev/docs/api/storefront/unstable/mutations/cartSelectedDeliveryOptionsUpdate)