Skip to content

Commit 69fc541

Browse files
committed
1 parent c2dc1e3 commit 69fc541

File tree

2 files changed

+91
-19
lines changed

2 files changed

+91
-19
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Attribute | Data Type | Description
2+
--- | --- | ---
3+
`applied_coupon` | [`AppliedCoupon`][AppliedCoupon] | Deprecated. Use `applied_coupons` instead
4+
`applied_coupons` | [[`AppliedCoupon`]][AppliedCoupon] | An array of `AppliedCoupon` objects. Each object contains the `code` text attribute, which specifies the coupon code
5+
`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
6+
`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
7+
`available_payment_methods` | [[AvailablePaymentMethod]][AvailablePaymentMethod] | Available payment methods
8+
`billing_address` | [BillingCartAddress][BillingCartAddress] | Contains the billing address specified in the customer's cart
9+
`email` | String | The customer's email address
10+
`gift_message` | [`GiftMessage`][GiftMessage] | Contains the entered gift message for the cart
11+
`id` | ID! | The ID of the cart
12+
`is_virtual` | Boolean! | Indicates whether the cart contains only virtual products
13+
`items` | [[CartItemInterface]][CartItemInterface] | Contains the items in the customer's cart
14+
`prices` | [CartPrices][CartPrices] | Contains subtotals and totals
15+
`selected_payment_method` | [SelectedPaymentMethod][SelectedPaymentMethod] | Selected payment method
16+
`shipping_addresses` | [[ShippingCartAddress]][ShippingCartAddress]! | Contains one or more shipping addresses
17+
`total_quantity` | Float! | Total Quantity of products in the cart
18+
19+
[AppliedCoupon]: {{page.baseurl}}/graphql/queries/cart.html#AppliedCoupon
20+
[AppliedGiftCard]: {{page.baseurl}}/graphql/queries/cart.html#AppliedGiftCard
21+
[AppliedStoreCredit]: {{page.baseurl}}/graphql/queries/cart.html#AppliedStoreCredit
22+
[AvailablePaymentMethod]: {{page.baseurl}}/graphql/queries/cart.html#AvailablePaymentMethod
23+
[BillingCartAddress]: {{page.baseurl}}/graphql/queries/cart.html#BillingCartAddress
24+
[CartItemInterface]: {{page.baseurl}}/graphql/queries/cart.html#CartItemInterface
25+
[CartPrices]: {{page.baseurl}}/graphql/queries/cart.html#CartPrices
26+
[GiftMessage]: {{page.baseurl}}/graphql/queries/cart.html#GiftMessage
27+
[SelectedPaymentMethod]: {{page.baseurl}}/graphql/queries/cart.html#SelectedPaymentMethod
28+
[ShippingCartAddress]: {{page.baseurl}}/graphql/queries/cart.html#ShippingCartAddress

src/guides/v2.4/graphql/queries/cart.md

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,40 @@ The `3T1free` rule is applied first, and Magento returns the price of a single s
383383
}
384384
```
385385

386+
### Gift message example
387+
388+
The following example shows how to retrieve a gift message for cart.
389+
390+
**Request:**
391+
392+
```graphql
393+
{
394+
cart(cart_id: "8RNne0xE1QGaTAtHl1D9hdpxvlePKeXp") {
395+
gift_message {
396+
to
397+
from
398+
message
399+
}
400+
}
401+
}
402+
```
403+
404+
**Response:**
405+
406+
```json
407+
{
408+
"data": {
409+
"cart": {
410+
"gift_message": {
411+
"to": "Mercutio",
412+
"from": "Romeo",
413+
"message": "I thought all for the best."
414+
}
415+
}
416+
}
417+
}
418+
```
419+
386420
### Tier price example
387421

388422
In the following example, tier prices has been established for product `24-UG01` and `24-UG05`, as shown in the following table:
@@ -562,7 +596,7 @@ query {
562596

563597
## Input attributes
564598

565-
Attribute | Data Type | Description
599+
Attribute | Data Type | Description
566600
--- | --- | ---
567601
`cart_id` | String! | A 32-character string that is created when you [create a cart]({{page.baseurl}}/graphql/mutations/create-empty-cart.html)
568602

@@ -574,21 +608,21 @@ The top-level `Cart` object is listed first. All interfaces and child objects ar
574608

575609
The `Cart` object can contain the following attributes.
576610

577-
{% include graphql/cart-object.md %}
611+
{% include graphql/cart-object-24.md %}
578612

579613
### AppliedCoupon object {#AppliedCoupon}
580614

581-
The `AppliedCoupon` object must contain the following attributes.
615+
The `AppliedCoupon` object must contain the following attribute.
582616

583-
Attribute | Data Type | Description
617+
Attribute | Data Type | Description
584618
--- | --- | ---
585619
`code` | String! | The coupon code applied to the order
586620

587621
### AppliedGiftCard object {#AppliedGiftCard}
588622

589623
The `AppliedGiftCard` object can contain the following attributes.
590624

591-
Attribute | Data Type | Description
625+
Attribute | Data Type | Description
592626
--- | --- | ---
593627
`applied_balance` | Money | Applied balance to the current cart
594628
`code` | String | The gift card code applied to the order
@@ -609,7 +643,7 @@ Attribute | Data Type | Description
609643

610644
The `AvailablePaymentMethod` object must contain the following attributes.
611645

612-
Attribute | Data Type | Description
646+
Attribute | Data Type | Description
613647
--- | --- | ---
614648
`code` | String! | The payment method code
615649
`title` | String! | The payment method title
@@ -618,7 +652,7 @@ Attribute | Data Type | Description
618652

619653
The `AvailableShippingMethod` object can contain the following attributes.
620654

621-
Attribute | Data Type | Description
655+
Attribute | Data Type | Description
622656
--- | --- | ---
623657
`amount` | Money! | The cost of shipping using this shipping method
624658
`available` | Boolean! | Indicates whether this shipping method can be applied to the cart
@@ -639,7 +673,7 @@ The `BillingCartAddress` object implements [`CartAddressInterface`](#CartAddress
639673

640674
The `CartAddressCountry` object can contain the following attributes.
641675

642-
Attribute | Data Type | Description
676+
Attribute | Data Type | Description
643677
--- | --- | ---
644678
`code` | String! | The country code
645679
`label` | String! | The display label for the country
@@ -648,7 +682,7 @@ Attribute | Data Type | Description
648682

649683
The `CartAddressInterface` contains the following attributes.
650684

651-
Attribute | Data Type | Description
685+
Attribute | Data Type | Description
652686
--- | --- | ---
653687
`city` | String! | The city specified for the billing address
654688
`company` | String | The company specified for the billing address
@@ -665,7 +699,7 @@ Attribute | Data Type | Description
665699

666700
The `CartAddressRegion` object can contain the following attributes.
667701

668-
Attribute | Data Type | Description
702+
Attribute | Data Type | Description
669703
--- | --- | ---
670704
`code` | String | The state or province code
671705
`label` | String | The display label for the region
@@ -675,7 +709,7 @@ Attribute | Data Type | Description
675709

676710
The `CartDiscount` object must contain the following attributes.
677711

678-
Attribute | Data Type | Description
712+
Attribute | Data Type | Description
679713
--- | --- | ---
680714
`amount` | Money | The amount of all discounts applied to the cart
681715
`label` | [String!]! | A concatenated list of strings that describe each applied discount
@@ -684,7 +718,7 @@ Attribute | Data Type | Description
684718

685719
The `CartItemInterface` can contain the following attributes.
686720

687-
Attribute | Data Type | Description
721+
Attribute | Data Type | Description
688722
--- | --- | ---
689723
`id` | String | ID of the item
690724
`prices` | [CartItemPrices](#CartItemPrices) | Includes the price of an item, any applied discounts, and calculated totals
@@ -695,7 +729,7 @@ Attribute | Data Type | Description
695729

696730
The `CartItemPrices` object can contain the following attributes.
697731

698-
Attribute | Data Type | Description
732+
Attribute | Data Type | Description
699733
--- | --- | ---
700734
`discounts`| [Discount] | An array of discounts to be applied to the cart item
701735
`price` | Money! | The price of the item before any discounts were applied
@@ -716,7 +750,7 @@ Attribute | Data Type | Description
716750

717751
The `CartPrices` object can contain the following attributes.
718752

719-
Attribute | Data Type | Description
753+
Attribute | Data Type | Description
720754
--- | --- | ---
721755
`applied_taxes` | [[CartTaxItem]](#CartTaxItem) | An array containing the names and amounts of taxes applied to the item
722756
`discount` | CartDiscount | Deprecated. Use `discounts` instead
@@ -730,7 +764,7 @@ Attribute | Data Type | Description
730764

731765
The `CartTaxItem` object must contain the following attributes.
732766

733-
Attribute | Data Type | Description
767+
Attribute | Data Type | Description
734768
--- | --- | ---
735769
`amount` | Money! | The amount of tax applied to the item
736770
`label` | String! | The description of the tax
@@ -743,16 +777,26 @@ If a cart rule does not have a label, Magento uses `Discount` as the default lab
743777

744778
The `Discount` object must contain the following attributes.
745779

746-
Attribute | Data Type | Description
780+
Attribute | Data Type | Description
747781
--- | --- | ---
748782
`amount` | Money! | The amount of the discount applied to the cart
749783
`label` | String! | The description of the discount
750784

785+
### GiftMessage object {#GiftMessage}
786+
787+
The `GiftMessage` object must contain the following attributes.
788+
789+
Attribute | Data Type | Description
790+
--- | --- | ---
791+
`to` | String! | Recipient name
792+
`from` | String! | Sender name
793+
`message` | String! | Gift message text
794+
751795
### SelectedPaymentMethod object {#SelectedPaymentMethod}
752796

753797
The `SelectedPaymentMethod` object can contain the following attributes.
754798

755-
Attribute | Data Type | Description
799+
Attribute | Data Type | Description
756800
--- | --- | ---
757801
`code` | String! | The payment method code
758802
`purchase_order_number` | String | The purchase order number
@@ -762,7 +806,7 @@ Attribute | Data Type | Description
762806

763807
The `SelectedShippingMethod` object can contain the following attributes.
764808

765-
Attribute | Data Type | Description
809+
Attribute | Data Type | Description
766810
--- | --- | ---
767811
`amount` | Money! | The cost of shipping using this shipping method
768812
`base_amount` | Money | Deprecated. This attribute is not applicable for GraphQL
@@ -775,7 +819,7 @@ Attribute | Data Type | Description
775819

776820
The `ShippingCartAddress` object implements [`CartAddressInterface`](#CartAddressInterface). It can also contain the following attributes.
777821

778-
Attribute | Data Type | Description
822+
Attribute | Data Type | Description
779823
--- | --- | ---
780824
`available_shipping_methods` | [[AvailableShippingMethod]](#AvailableShippingMethod) | An array that lists the shipping methods that can be applied to the cart
781825
`cart_items` | [[CartItemQuantity]](#CartItemQuantity) | Deprecated. Use `cart_items_v2` instead

0 commit comments

Comments
 (0)