diff --git a/src/_data/toc/graphql.yml b/src/_data/toc/graphql.yml index faf063e6130..1746f7a3176 100644 --- a/src/_data/toc/graphql.yml +++ b/src/_data/toc/graphql.yml @@ -243,13 +243,13 @@ pages: - label: sendEmailToFriend mutation url: /graphql/mutations/send-email-to-friend.html - - label: subscribeEmailToNewsletter mutation - url: /graphql/mutations/subscribe-email-to-newsletter.html - exclude_versions: ["2.3"] - - label: setBillingAddressesOnCart mutation url: /graphql/mutations/set-billing-address.html + - label: setGiftOptionsOnCart mutation + url: /graphql/mutations/set-gift-options.html + exclude_versions: ["2.3"] + - label: setGuestEmailOnCart mutation url: /graphql/mutations/set-guest-email.html @@ -265,6 +265,10 @@ pages: - label: setShippingMethodsOnCart mutation url: /graphql/mutations/set-shipping-method.html + - label: subscribeEmailToNewsletter mutation + url: /graphql/mutations/subscribe-email-to-newsletter.html + exclude_versions: ["2.3"] + - label: updateCartItems mutation url: /graphql/mutations/update-cart-items.html diff --git a/src/_includes/graphql/cart-object-24.md b/src/_includes/graphql/cart-object-24.md index 5d0b6921d6e..87911498ab1 100644 --- a/src/_includes/graphql/cart-object-24.md +++ b/src/_includes/graphql/cart-object-24.md @@ -5,14 +5,18 @@ Attribute | Data Type | Description `applied_gift_cards` | [[`AppliedGiftCard`]][AppliedGiftCard] | An array of `AppliedGiftCard` objects. An `AppliedGiftCard` object contains the `code` text attribute, which specifies the gift card code. `applied_gift_cards` is a Commerce-only attribute, defined in the GiftCardAccountGraphQl module `applied_reward_points`| [`RewardPointsAmount`][RewardPointsAmount] | The amount of reward points applied to the cart `applied_store_credit` | [`AppliedStoreCredit`][AppliedStoreCredit] | Contains store credit information applied to the cart. `applied_store_credit` is a Commerce-only attribute, defined in the CustomerBalanceGraphQl module +`available_gift_wrappings` | [GiftWrapping]! | The list of available gift wrapping options for the cart `available_payment_methods` | [[AvailablePaymentMethod]][AvailablePaymentMethod] | Available payment methods `billing_address` | [BillingCartAddress][BillingCartAddress] | Contains the billing address specified in the customer's cart `email` | String | The customer's email address `gift_message` | [GiftMessage][GiftMessage] | A gift message added to the cart +`gift_receipt_included` | Boolean! | Indicates if the customer requested a gift receipt for the cart +`gift_wrapping` | GiftWrapping | The selected gift wrapping for the cart `id` | ID! | The ID of the cart `is_virtual` | Boolean! | Indicates whether the cart contains only virtual products `items` | [[CartItemInterface]][CartItemInterface] | Contains the items in the customer's cart `prices` | [CartPrices][CartPrices] | Contains subtotals and totals +`printed_card_included` | Boolean! | Indicates if the customer requested a printed card for the cart `selected_payment_method` | [SelectedPaymentMethod][SelectedPaymentMethod] | Selected payment method `shipping_addresses` | [[ShippingCartAddress]][ShippingCartAddress]! | Contains one or more shipping addresses `total_quantity` | Float! | Total Quantity of products in the cart diff --git a/src/_includes/graphql/customer-orders-output.md b/src/_includes/graphql/customer-orders-output.md index af9987d7a77..7fa51296619 100644 --- a/src/_includes/graphql/customer-orders-output.md +++ b/src/_includes/graphql/customer-orders-output.md @@ -47,6 +47,9 @@ Attribute | Data type | Description `created_at` | String | Deprecated. Use the `order_date` attribute instead `credit_memos` | [[CreditMemo](#CreditMemo)] | Contains a list of credit memos for the order `grand_total` | Float | Deprecated. Use the `totals.grand_total` attribute instead +`gift_message` | [GiftMessage](#GiftMessage) | The entered gift message for the order +`gift_receipt_included` | Boolean! | Indicates if the customer requested a gift receipt for the order +`gift_wrapping` | [GiftWrapping](#GiftWrapping) | The selected gift wrapping for the order `id` | ID! | Unique identifier for the order `increment_id` | String | Deprecated. Use the `id` attribute instead `invoices` | [[Invoice](#Invoice)]! | Contains a list of invoices for the order @@ -54,7 +57,8 @@ Attribute | Data type | Description `number` | String! | The order number `order_date` | String! | The date the order was placed `order_number` | String! | Deprecated. Use the `number` attribute instead -`payment_methods` | [[OrderPaymentMethod](#OrderPaymentMethod)] | Payment details for the order +`payment_methods` | [[PaymentMethod](#PaymentMethod)] | Payment details for the order +`printed_card_included` | Boolean! | Indicates if the customer requested a printed card for the order `shipments` | [[OrderShipment](#OrderShipment)] | Shipment list for the order `shipping_address` | [OrderAddress](#OrderAddress) | Shipping address for the order `shipping_method` | String | Shipping method for the order @@ -227,6 +231,14 @@ Attribute | Data type | Description --- | --- | --- `gift_card` | [GiftCardItem](#GiftCardItem) | Selected gift card properties for a shipped item +### GiftMessage attributes {#GiftMessage} + +{% include graphql/gift-message.md %} + +### GiftWrapping attributes {#GiftWrapping} + +{% include graphql/gift-wrapping.md %} + #### Invoice attributes {#Invoice} The `Invoice` object provides details about a customer invoice. @@ -358,16 +370,6 @@ Attribute | Data type | Description `label` | String! | The name of the option `value` | String! | The value of the option -#### OrderPaymentMethod attributes {#OrderPaymentMethod} - -The OrderPaymentMethod data type contains details about the payment method used to pay for the order. - -Attribute | Data type | Description ---- | --- | --- -`additional_data` | [[KeyValue](#KeyValue)] | Additional data per payment method type -`name` | String! | The label that describes the payment method -`type` | String! | The payment method code that indicates how the order was paid for - #### OrderShipment attributes {#OrderShipment} Attribute | Data type | Description @@ -393,6 +395,16 @@ Attribute | Data type | Description `total_shipping` | Money! | The shipping costs for the order `total_tax` | Money! | The amount of tax applied to the order +#### PaymentMethod attributes {#PaymentMethod} + +The PaymentMethod data type contains details about the payment method used to pay for the order. + +Attribute | Data type | Description +--- | --- | --- +`additional_data` | [[KeyValue](#KeyValue)] | Additional data per payment method type +`name` | String! | The label that describes the payment method +`type` | String! | The payment method code that indicates how the order was paid for + #### RewardPoints attributes {#RewardPoints} The `RewardPoints` object provides details about the customer's reward points balance, history, and related information. diff --git a/src/_includes/graphql/gift-message.md b/src/_includes/graphql/gift-message.md new file mode 100644 index 00000000000..4bbc63b9aae --- /dev/null +++ b/src/_includes/graphql/gift-message.md @@ -0,0 +1,7 @@ +The `GiftMessage` object can contain the following attributes. + +Attribute | Data Type | Description +--- | --- | --- +`from` | String! | The name of the gift sender +`message` | String! | The text of the gift message +`to` | String! | The name of the gift recipient diff --git a/src/_includes/graphql/gift-wrapping.md b/src/_includes/graphql/gift-wrapping.md new file mode 100644 index 00000000000..878fd99db5b --- /dev/null +++ b/src/_includes/graphql/gift-wrapping.md @@ -0,0 +1,17 @@ +The `GiftWrapping` object can contain the following attributes. + +Attribute | Data Type | Description +--- | --- | --- +`design` | String! | The name of the gift wrapping design +`id` | ID! | The unique identifier for the gift wrapping option +`image` | [GiftWrappingImage](#GiftWrappingImage) | The preview image for the gift wrapping option +`price` | Money! | The price of the gift wrapping option + +### GiftWrappingImage object {#GiftWrappingImage} + +The `GiftWrappingImage` object must contain the following attributes. + +Attribute | Data Type | Description +--- | --- | --- +`label` | String! | The label of the gift wrapping preview image +`url` | String! | The URL of the gift wrapping preview image diff --git a/src/guides/v2.4/graphql/mutations/set-gift-options.md b/src/guides/v2.4/graphql/mutations/set-gift-options.md new file mode 100644 index 00000000000..79c104ad0f2 --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/set-gift-options.md @@ -0,0 +1,186 @@ +--- +group: graphql +title: setGiftOptionsOnCart mutation +--- + +The `setGiftOptionsOnCart` mutation allows the buyer to set the following gift options on the cart level: + +* Gift messages +* Gift wrapping +* A gift receipt to accompany the order +* A printed card to accompany the order + +{:.bs-callout-info} +Gift messages are a feature of {{site.data.var.ce}}. All other gift options require {{site.data.var.ee}}. + +To remove a gift message, set the `gift_message` object to null. To remove gift wrapping, set the `gift_wrapping_id` attribute to null. + +Use the [updateCartItems mutation]({{page.baseurl}}/graphql/mutations/update-cart-items.html) to set gift messages and gift wrapping on individual items. + +These options are configured on the **Stores** > Configuration > **Sales** > **Sales** > **Gift Options** screen. To determine whether these options are enabled, specify these attributes in the [`storeConfig` query]({{page.baseurl}}/graphql/queries/store-config.html). + +* `allow_gift_receipt` +* `allow_gift_wrapping_on_order` +* `allow_printed_card` +* `cart_gift_wrapping` +* `cart_printed_card` +* `printed_card_price` +* `sales_gift_wrapping` +* `sales_printed_card` + +Gift wrapping is available for simple, configurable, bundle products as well as physical gift cards. + +## Syntax + +`mutation: {setGiftOptionsOnCart(input: SetGiftOptionsOnCartInput): SetGiftOptionsOnCartOutput}` + +## Example usage + +The following example adds a gift message, gift wrapping, and a gift receipt to the cart. + +**Request:** + +```graphql +mutation { + setGiftOptionsOnCart( + input: { + cart_id: "8k0Q4MpH2IGahWrTRtqM61YV2MtLPApz" + gift_message: { + to: "Alex" + from: "Veronica" + message: "Happy Birthday!" + } + gift_wrapping_id: "Mg==" + gift_receipt_included: true + printed_card_included: false + } + ) { + cart { + id + gift_message { + to + from + message + } + gift_wrapping { + id + } + gift_receipt_included + printed_card_included + items { + quantity + prices { + price { + value + currency + } + } + } + prices { + gift_options { + gift_wrapping_for_order { + value + currency + } + } + grand_total { + value + currency + } + } + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "setGiftOptionsOnCart": { + "cart": { + "id": "8k0Q4MpH2IGahWrTRtqM61YV2MtLPApz", + "gift_message": { + "to": "Alex" + "from": "Veronica" + "message": "Happy Birthday!" + } + "gift_wrapping": { + "id": "2" + }, + "gift_receipt_included": true, + "printed_card_included": false, + "items": [ + { + "quantity": 1, + "prices": { + "price": { + "value": 32, + "currency": "USD" + } + } + }, + { + "quantity": 1, + "prices": { + "price": { + "value": 84, + "currency": "USD" + } + } + } + ], + "prices": { + "gift_options": { + "gift_wrapping_for_order": { + "value": 7, + "currency": "USD" + } + }, + "grand_total": { + "value": 132.57, + "currency": "USD" + } + } + } + } + } +} +``` + +## Input attributes + +The `SetGiftOptionsOnCartInput` object can contain the following attributes: + +Attribute | Data Type | Description +--- | --- | --- +`cart_id` | String! | The unique ID that identifies the shopper's cart +`gift_message` | [GiftMessageInput](#GiftMessageInput) | Gift message details for the cart +`gift_receipt_included` | Boolean! | Indicates whether the customer requested a gift receipt for the cart +`gift_wrapping_id` | ID | The unique identifier of the gift wrapping to be used for the cart +`printed_card_included` | Boolean! | Indicates whether the customer requested a printed card for the cart + +### GiftMessageInput {#GiftMessageInput} + +The `GiftMessageInput` object must contain the following attributes: + +Attribute | Data Type | Description +--- | --- | --- +`from` | String! | The name of the gift sender +`message` | String! | The text of the gift message +`to` | String! | The name of the gift recipient + +## Output attributes + +The `SetGiftOptionsOnCartOutput` object contains the `Cart` object. + +Attribute | Data Type | Description +--- | --- | --- +`cart` |[Cart!](#CartObject) | Describes the contents of the specified shopping cart + +### Cart object {#CartObject} + +{% include graphql/cart-object-24.md %} + +[Cart query output]({{page.baseurl}}/graphql/queries/cart.html#cart-output) provides more information about the `Cart` object. diff --git a/src/guides/v2.4/graphql/mutations/update-cart-items.md b/src/guides/v2.4/graphql/mutations/update-cart-items.md index 2c413a81ecb..c534762e1f8 100644 --- a/src/guides/v2.4/graphql/mutations/update-cart-items.md +++ b/src/guides/v2.4/graphql/mutations/update-cart-items.md @@ -1,11 +1,9 @@ --- group: graphql title: updateCartItems mutation -redirect from: - - /guides/v2.3/graphql/reference/quote-update-cart-items.html --- -The `updateCartItems` mutation allows you to replace the current quantity of one or more cart items with the specified quantities. It does not perform calculations to determine the quantity of cart items. +The `updateCartItems` mutation allows you to modify items in the specified cart. You can also replace the current quantity of one or more cart items with the specified quantities. The mutation does not perform calculations to determine the quantity of cart items. {:.bs-callout-info} Setting the quantity to `0` removes an item from the cart. @@ -91,31 +89,43 @@ mutation { The `UpdateCartItemsInput` object is listed first. All child objects are listed in alphabetical order. -### UpdateCartItemsInput object {#UpdateCartItemsInput} +### UpdateCartItemsInput attributes {#UpdateCartItemsInput} -The `UpdateCartItemsInput` object must contain the following attributes: +The `UpdateCartItemsInput` object must contain the following attributes. Attribute | Data Type | Description --- | --- | --- `cart_id` | String! | The unique ID that identifies the customer's cart `cart_items` | [CartItemUpdateInput!](#CartItemUpdateInput) | Contains the cart item IDs and quantity of each item -### CartItemUpdateInput object {#CartItemUpdateInput} +### CartItemUpdateInput attributes {#CartItemUpdateInput} -The `CartItemUpdateInput` object may contain the following attributes: +The `CartItemUpdateInput` object can contain the following attributes. Attribute | Data Type | Description --- | --- | --- `cart_item_id` | Int! | The unique ID assigned when a customer places an item in the cart `customizable_options` | [CustomizableOptionInput!] | An array that defines customizable options for the product +`gift_message` | [GiftMessageInput](#GiftMessageInput) | Gift message details for the cart item +`gift_wrapping_id` | ID | The unique identifier of the gift wrapping to be used for the cart item `quantity` | Float | The new quantity of the item. A value of `0` removes the item from the cart -### CustomizableOptionInput object {#CustomizableOptionInputSimple} +### CustomizableOptionInput attributes {#CustomizableOptionInputSimple} -The `CustomizableOptionInput` object must contain the following attributes: +The `CustomizableOptionInput` object must contain the following attributes. {% include graphql/customizable-option-input.md %} +### GiftMessageInput attributes {#GiftMessageInput} + +The `GiftMessageInput` object must contain the following attributes. + +Attribute | Data Type | Description +--- | --- | --- +`from` | String! | The name of the gift sender +`message` | String! | The text of the gift message +`to` | String! | The name of the gift recipient + ## Output attributes The `UpdateCartItemsOutput` object contains the `Cart` object. diff --git a/src/guides/v2.4/graphql/queries/cart.md b/src/guides/v2.4/graphql/queries/cart.md index c86320eff44..2f8bb45ae86 100644 --- a/src/guides/v2.4/graphql/queries/cart.md +++ b/src/guides/v2.4/graphql/queries/cart.md @@ -682,6 +682,15 @@ Attribute | Data Type | Description ### CartItemInterface {#CartItemInterface} +The `CartItemInterface` has the following implementations: + +* BundleCartItem +* ConfigurableCartItem +* DownloadableCartItem +* GiftCardCartItem +* SimpleCartItem +* VirtualCartItem + The `CartItemInterface` can contain the following attributes. Attribute | Data Type | Description @@ -721,6 +730,7 @@ Attribute | Data Type | Description `applied_taxes` | [[CartTaxItem]](#CartTaxItem) | An array containing the names and amounts of taxes applied to the item `discount` | CartDiscount | Deprecated. Use `discounts` instead `discounts` | [Discount] | An array containing all discounts applied to the cart +`gift_options` | [GiftOptionsPrices](#GiftOptionsPrices) | The list of prices for the selected gift options `grand_total` | Money | The total, including discounts, taxes, shipping, and other fees `subtotal_excluding_tax` | Money | Subtotal without taxes `subtotal_including_tax` | Money | Subtotal with taxes @@ -750,13 +760,21 @@ Attribute | Data Type | Description ### GiftMessage object {#GiftMessage} -The `GiftMessage` object must contain the following attributes. +{% include graphql/gift-message.md %} + +### GiftOptionsPrices object {#GiftOptionsPrices} + +The `GiftOptionsPrices` object can contain the following attributes. Attribute | Data Type | Description --- | --- | --- -`from` | String! | Identifies the sender -`message` | String! | The gift message text -`to` | String! | Identifies the recipient +`gift_wrapping_for_items` | Money | The price of the gift wrapping for all individual order items +`gift_wrapping_for_order` | Money | The price of the gift wrapping for the whole order +`printed_card` | Money | The price of the printed card + +### GiftWrapping object {#GiftWrapping} + +{% include graphql/gift-wrapping.md %} ### RewardPointsAmount {#RewardPointsAmount} diff --git a/src/guides/v2.4/graphql/queries/store-config.md b/src/guides/v2.4/graphql/queries/store-config.md index 8d91bffbc5a..484063ed012 100644 --- a/src/guides/v2.4/graphql/queries/store-config.md +++ b/src/guides/v2.4/graphql/queries/store-config.md @@ -237,17 +237,25 @@ The following query returns enumeration values that indicate the store's fixed p ## Output attributes +The `StoreConfig` object can contain the following attributes. + Attribute | Data Type | Description | Default or example value --- | --- | --- | --- `absolute_footer` | String | Contains scripts that must be included in the HTML before the closing `
` tag | null +`allow_gift_wrapping_on_order` | String | Indicates if a gift wrapping can be added for the entire order. Possible values: 1 (Yes) and 0 (No) | 1 +`allow_gift_wrapping_on_order_items` | String | Indicates if a gift wrapping can be added for individual order items. Possible values: 1 (Yes) and 0 (No) | 1 +`allow_gift_receipt` | String | Indicates if the gift sender has the option to send a gift receipt. Possible values: 1 (Yes) and 0 (No) | 1 `allow_items` | String | Allows gift messages for order items. Possible values: 1 (Yes) and 0 (No).