From 279bf7a59810b6e88701b50b7dcaa29d02b680f5 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 14 Apr 2019 12:27:43 +0300 Subject: [PATCH 01/40] magento/devdocs#589: Add a tutorial for the checkout workflow --- .../checkout/checkout-add-product-to-cart.md | 49 +++++++++++ .../checkout/checkout-billing-address.md | 20 +++++ .../tutorials/checkout/checkout-customer.md | 85 +++++++++++++++++++ .../checkout/checkout-payment-method.md | 30 +++++++ .../checkout/checkout-place-order.md | 33 +++++++ .../checkout/checkout-shipping-address.md | 20 +++++ .../checkout/checkout-shipping-method.md | 73 ++++++++++++++++ .../checkout/checkout-shopping-cart.md | 33 +++++++ guides/v2.3/graphql/tutorials/index.md | 22 +++++ 9 files changed, 365 insertions(+) create mode 100644 guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md create mode 100644 guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md create mode 100644 guides/v2.3/graphql/tutorials/checkout/checkout-customer.md create mode 100644 guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md create mode 100644 guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md create mode 100644 guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md create mode 100644 guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md create mode 100644 guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md create mode 100644 guides/v2.3/graphql/tutorials/index.md diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md new file mode 100644 index 00000000000..06ae2a6b497 --- /dev/null +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -0,0 +1,49 @@ +--- +layout: tutorial +group: graphql +title: Step 3. Add product to cart +subtitle: GraphQl checkout tutorial +return_to: + title: GraphQl checkout tutorial + url: graphql/tutorials/index.html +menu_order: 3 +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +**Request** +```text +mutation addSimpleProductsToCart( + $cart_id: String! + $qty: Float! + $sku: String! +) { + addSimpleProductsToCart( + input: { + cart_id: $cart_id + cartItems: { + customizable_options: [] + data: { + qty: $qty + sku: $sku + } + } + } + ) { + cart { + items { + id + product { + sku + stock_status + } + qty + } + } + } +} +``` + +**Response** +```json +``` \ No newline at end of file diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md new file mode 100644 index 00000000000..39a519fa9d8 --- /dev/null +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -0,0 +1,20 @@ +--- +layout: tutorial +group: graphql +title: Step 5. Set billing address +subtitle: GraphQl checkout tutorial +return_to: + title: GraphQl checkout tutorial + url: graphql/tutorials/index.html +menu_order: 5 +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +**Request** +```text +``` + +**Response** +```json +``` diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md new file mode 100644 index 00000000000..1d18d86ba72 --- /dev/null +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md @@ -0,0 +1,85 @@ +--- +layout: tutorial +group: graphql +title: Step 1. Define customer +subtitle: GraphQl checkout tutorial +return_to: + title: GraphQl checkout tutorial + url: graphql/tutorials/index.html +menu_order: 1 +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +Customers can make purchases in two ways: +- As a logged-in user +- As a guest user who does not create an account + +If you want to place order as guest then skip this step. + +If you want to place order as a new customer then you should use `createCustomer` mutation to register new customer in the store. + +**Request** +```text +mutation { + createCustomer( + input: { + firstname: "Bob" + lastname: "Loblaw" + email: "bobloblaw@example.com" + password: "b0bl0bl@w" + is_subscribed: true + } + ) { + customer { + id + firstname + lastname + email + is_subscribed + } + } +} +``` + +**Response** +```json +{ + "data": { + "createCustomer": { + "customer": { + "id": 5, + "firstname": "Bob", + "lastname": "Loblaw", + "email": "bobloblaw@example.com", + "is_subscribed": true + } + } + } +} +``` + +Check this ["Customer endpoint"]({{ page.baseurl }}/graphql/reference/customer.html#create-a-customer) page to get the additional information. + +If you want to place order as a new customer or a registered customer then you should get customer's authorization token. Use `generateCustomerToken` mutation for that. +**Request** +```text +mutation { + generateCustomerToken(email: "bobloblaw@example.com", password: "b0bl0bl@w") { + token + } +} +``` + +**Response** +```json +{ + "data": { + "generateCustomerToken": { + "token": "hoyz7k697ubv5hcpq92yrtx39i7x10um" + } + } + } +``` + +See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) topic to get more details. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md new file mode 100644 index 00000000000..8090536c419 --- /dev/null +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md @@ -0,0 +1,30 @@ +--- +layout: tutorial +group: graphql +title: Step 7. Set payment method +subtitle: GraphQl checkout tutorial +return_to: + title: GraphQl checkout tutorial + url: graphql/tutorials/index.html +menu_order: 7 +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +Use the following query to get all available payment methods for your order. + +**Request** +```text +{ + cart(cart_id: "$maskedQuoteId") { + available_payment_methods { + code + title + } + } +} +``` + +**Response** +```json +``` diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md new file mode 100644 index 00000000000..2f9f2132cd1 --- /dev/null +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md @@ -0,0 +1,33 @@ +--- +layout: tutorial +group: graphql +title: Step 8. Place order +subtitle: GraphQl checkout tutorial +return_to: + title: GraphQl checkout tutorial + url: graphql/tutorials/index.html +menu_order: 8 +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +**Request** +```text +mutation placeOrder( + $cart_id: String! +) { + placeOrder( + input: { + cart_id: $cart_id + } + ) { + order { + order_id + } + } +} +``` + +**Response** +```json +``` diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md new file mode 100644 index 00000000000..275685dfe45 --- /dev/null +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -0,0 +1,20 @@ +--- +layout: tutorial +group: graphql +title: Step 4. Set shipping address +subtitle: GraphQl checkout tutorial +return_to: + title: GraphQl checkout tutorial + url: graphql/tutorials/index.html +menu_order: 4 +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +**Request** +```text +``` + +**Response** +```json +``` diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md new file mode 100644 index 00000000000..e413a4b2e85 --- /dev/null +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -0,0 +1,73 @@ +--- +layout: tutorial +group: graphql +title: Step 6. Set shipping method +subtitle: GraphQl checkout tutorial +return_to: + title: GraphQl checkout tutorial + url: graphql/tutorials/index.html +menu_order: 6 +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +Use `cart` query to retrieve available shipping methods for your quote. +**Request** +```text +query { + cart (cart_id: "{$maskedQuoteId}") { + shipping_addresses { + available_shipping_methods { + amount + base_amount + carrier_code + carrier_title + error_message + method_code + method_title + price_excl_tax + price_incl_tax + } + } + } +} +``` + +**Response** +```json + +``` + +Use `setShippingMethodsOnCart` mutation query to define a shipping method for your order. + +**Request** +The following mutation query assigns UPS "Ground" method. +```text +mutation { + setShippingMethodsOnCart(input: { + cart_id: "$maskedQuoteId" + shipping_methods: [ + { + cart_address_id: $shippingAddressId + carrier_code: "ups" + method_code: "GND" + } + ] + }) { + cart { + shipping_addresses { + selected_shipping_method { + carrier_code + method_code + label + } + } + } + } +} +``` + +**Response** +```json + +``` diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md new file mode 100644 index 00000000000..ce5b99b2bb9 --- /dev/null +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md @@ -0,0 +1,33 @@ +--- +layout: tutorial +group: graphql +title: Step 2. Create empty cart +subtitle: GraphQl checkout tutorial +return_to: + title: GraphQl checkout tutorial + url: graphql/tutorials/index.html +menu_order: 2 +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +**Request** +This mutation query creates an empty cart: +```text +mutation { + createEmptyCart +} +``` + +**Response** +```json +{ + "data": { + "createEmptyCart": "gqjcFzgL8hNxxdrqLDEkMP487nOWBXOv" + } +} +``` + +If you create a shopping cart for the registered customer then you should send customer's authorization token in the `Authorization` parameter of the header: + +![GraphiQL Authorization Bearer]({{ page.baseurl }}/graphql/images/graphql-authorization.png) diff --git a/guides/v2.3/graphql/tutorials/index.md b/guides/v2.3/graphql/tutorials/index.md new file mode 100644 index 00000000000..6f7ceccc1d0 --- /dev/null +++ b/guides/v2.3/graphql/tutorials/index.md @@ -0,0 +1,22 @@ +--- +group: graphql +title: GraphQl checkout tutorial +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +This tutorial provides information how you can place order through GraphQl. Customers can make purchases in two ways: +- As a logged-in user +- As a guest user who does not create an account + +Basically checkout process in GraphQl consists of the next steps: +- define customer (create customer or use registered customer account or place order as guest) +- create empty cart +- add a product to cart +- set shipping address +- set billing address +- set shipping method +- set payment method +- place order + +//setQuoteEmail \ No newline at end of file From 9b5d929d48a8f75d97985ab764c25c0706f23c71 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Mon, 15 Apr 2019 09:15:33 +0300 Subject: [PATCH 02/40] magento/devdocs#589: Add a tutorial for the checkout workflow --- .../checkout/checkout-add-product-to-cart.md | 59 +++- .../checkout/checkout-billing-address.md | 312 ++++++++++++++++++ .../tutorials/checkout/checkout-coupon.md | 36 ++ .../tutorials/checkout/checkout-customer.md | 44 +-- .../checkout/checkout-payment-method.md | 69 +++- .../checkout/checkout-place-order.md | 31 +- .../checkout/checkout-quote-email.md | 49 +++ .../checkout/checkout-shipping-address.md | 91 +++++ .../checkout/checkout-shipping-method.md | 94 +++++- .../checkout/checkout-shopping-cart.md | 12 +- guides/v2.3/graphql/tutorials/index.md | 21 +- 11 files changed, 750 insertions(+), 68 deletions(-) create mode 100644 guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md create mode 100644 guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index 06ae2a6b497..4aed1956a48 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -11,23 +11,30 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- +GraphQL supports [7 types of product]({{ page.baseurl }}/graphql/reference/product-interface-implementations.html) which can be added into shopping cart: + - bundle product + - configurable product + - downloadable product + - grouped product + - simple product + - virtual product + - gift card product (available for commerce version) + **Request** +The following query adds a simple product into shopping cart. ```text -mutation addSimpleProductsToCart( - $cart_id: String! - $qty: Float! - $sku: String! -) { +mutation { addSimpleProductsToCart( input: { - cart_id: $cart_id - cartItems: { - customizable_options: [] - data: { - qty: $qty - sku: $sku + cart_id: "{{ CART_ID }}" + cartItems: [ + { + data: { + qty: 1 + sku: "simple-product" + } } - } + ] } ) { cart { @@ -44,6 +51,32 @@ mutation addSimpleProductsToCart( } ``` +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + **Response** ```json -``` \ No newline at end of file +{ + "data": { + "addSimpleProductsToCart": { + "cart": { + "items": [ + { + "id": "508", + "product": { + "sku": "simple-product", + "stock_status": "IN_STOCK" + }, + "qty": 1 + } + ] + } + } + } +} +``` + +{:.bs-callout .bs-callout-info} +Send customer's authorization token in the `Authorization` parameter of the header if you add product into shopping cart as a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. + +Use `updateCartItems` mutation query to update shopping cart items and `removeItemFromCart` to remove product from the shopping cart. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index 39a519fa9d8..c12d9aafa14 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -11,10 +11,322 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- +Use [setBillingAddressOnCart]({{ page.baseurl }}/graphql/reference/quote.html#set-the-billing-address-on-cart-attributes) mutation query to set a billing address. GraphQl allows to add billing address in the next ways: +- add new billing address +- add new billing address and set it as a shipping addresses +- use the existing customer's address from address book (available for registered customers) + +### New billing address + +The following mutation adds a new billing address. + +**Request** + +```text +mutation { + setBillingAddressOnCart( + input: { + cart_id: "{{ CART_ID }}" + billing_address: { + address: { + firstname: "John" + lastname: "Doe" + company: "Company Name" + street: ["320 N Crescent Dr", "Beverly Hills"] + city: "Los Angeles" + region: "CA" + postcode: "90210" + country_code: "US" + telephone: "123-456-0000" + save_in_address_book: false + } + } + } + ) { + cart { + billing_address { + firstname + lastname + company + street + city + postcode + telephone + country { + code + label + } + address_type + } + } + } +} +``` + +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + +**Response** + +```json +{ + "data": { + "setBillingAddressOnCart": { + "cart": { + "billing_address": { + "firstname": "John", + "lastname": "Doe", + "company": "Company Name", + "street": [ + "320 N Crescent Dr", + "Beverly Hills" + ], + "city": "Los Angeles", + "postcode": "90210", + "telephone": "123-456-0000", + "country": { + "code": "US", + "label": "US" + }, + "address_type": "BILLING" + } + } + } + } +} +``` + +### + +**Request** + +```text +mutation { + setBillingAddressOnCart( + input: { + cart_id: "{{ CART_ID }}" + billing_address: { + address: { + firstname: "John" + lastname: "Doe" + company: "Company Name" + street: ["320 N Crescent Dr", "Beverly Hills"] + city: "Los Angeles" + region: "CA" + postcode: "90210" + country_code: "US" + telephone: "123-456-0000" + save_in_address_book: false + } +# use_for_shipping: true + } + } + ) { + cart { + billing_address { + firstname + lastname + company + street + city + postcode + telephone + country { + code + label + } + address_type + } + shipping_addresses { + firstname + lastname + company + street + city + postcode + telephone + country { + code + label + } + address_type + } + } + } +} +``` + +**Response** +```json +{ + "data": { + "setBillingAddressOnCart": { + "cart": { + "billing_address": { + "firstname": "John", + "lastname": "Doe", + "company": "Company Name", + "street": [ + "320 N Crescent Dr", + "Beverly Hills" + ], + "city": "Los Angeles", + "postcode": "90210", + "telephone": "123-456-0000", + "country": { + "code": "US", + "label": "US" + }, + "address_type": "BILLING" + }, + "shipping_addresses": [ + { + "firstname": "John", + "lastname": "Doe", + "company": "Company Name", + "street": [ + "320 N Crescent Dr", + "Beverly Hills" + ], + "city": "Los Angeles", + "postcode": "90210", + "telephone": "123-456-0000", + "country": { + "code": "US", + "label": "US" + }, + "address_type": "SHIPPING" + } + ] + } + } + } +} +``` + + +### Use the existing customer address + +**Request** +```text +mutation { + setBillingAddressOnCart( + input: { + cart_id: "{{ CART_ID }}" + billing_address: { + customer_address_id: 937 + } + } + ) { + cart { + billing_address { + city + } + } + } +} +``` **Request** ```text +mutation { + setBillingAddressOnCart( + input: { + cart_id: "{{ CART_ID }}" + billing_address: { + address: { + firstname: "John" + lastname: "Doe" + company: "Company Name" + street: ["320 N Crescent Dr", "Beverly Hills"] + city: "Los Angeles" + region: "CA" + postcode: "90210" + country_code: "US" + telephone: "123-456-0000" + save_in_address_book: false + } +# use_for_shipping: true + } + } + ) { + cart { + billing_address { + firstname + lastname + company + street + city + postcode + telephone + country { + code + label + } + address_type + } + shipping_addresses { + firstname + lastname + company + street + city + postcode + telephone + country { + code + label + } + address_type + } + } + } +} ``` **Response** ```json +{ + "data": { + "setBillingAddressOnCart": { + "cart": { + "billing_address": { + "firstname": "John", + "lastname": "Doe", + "company": "Company Name", + "street": [ + "320 N Crescent Dr", + "Beverly Hills" + ], + "city": "Los Angeles", + "postcode": "90210", + "telephone": "123-456-0000", + "country": { + "code": "US", + "label": "US" + }, + "address_type": "BILLING" + }, + "shipping_addresses": [ + { + "firstname": "John", + "lastname": "Doe", + "company": "Company Name", + "street": [ + "320 N Crescent Dr", + "Beverly Hills" + ], + "city": "Los Angeles", + "postcode": "90210", + "telephone": "123-456-0000", + "country": { + "code": "US", + "label": "US" + }, + "address_type": "SHIPPING" + } + ] + } + } + } +} ``` diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md new file mode 100644 index 00000000000..05c1275e2c6 --- /dev/null +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md @@ -0,0 +1,36 @@ +--- +layout: tutorial +group: graphql +title: Step 8. Apply coupon +subtitle: GraphQl checkout tutorial +return_to: +title: GraphQl checkout tutorial +url: graphql/tutorials/index.html +menu_order: 8 +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +Use `applyCouponToCart` to apply a discount coupon to shopping cart. + +**Request** + +```text +``` + +**Response** + +```json +``` + +Use `removeCouponFromCart` to remove a discount coupon from shopping cart. + +**Request** + +```text +``` + +**Response** + +```json +``` diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md index 1d18d86ba72..0a91aa26558 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md @@ -15,19 +15,21 @@ Customers can make purchases in two ways: - As a logged-in user - As a guest user who does not create an account -If you want to place order as guest then skip this step. +{:.bs-callout .bs-callout-tip} +Skip this step if you want to place order as a guest user. -If you want to place order as a new customer then you should use `createCustomer` mutation to register new customer in the store. +If you want to place order as a new customer use `createCustomer` mutation to register new customer in the store. **Request** + ```text mutation { createCustomer( input: { - firstname: "Bob" - lastname: "Loblaw" - email: "bobloblaw@example.com" - password: "b0bl0bl@w" + firstname: "John" + lastname: "Doe" + email: "john.doe@example.com" + password: "b1b2b3l@w+" is_subscribed: true } ) { @@ -43,15 +45,16 @@ mutation { ``` **Response** + ```json { "data": { "createCustomer": { "customer": { - "id": 5, - "firstname": "Bob", - "lastname": "Loblaw", - "email": "bobloblaw@example.com", + "id": 6, + "firstname": "John", + "lastname": "Doe", + "email": "john.doe@example.com", "is_subscribed": true } } @@ -59,27 +62,30 @@ mutation { } ``` -Check this ["Customer endpoint"]({{ page.baseurl }}/graphql/reference/customer.html#create-a-customer) page to get the additional information. +Check ["Customer endpoint"]({{ page.baseurl }}/graphql/reference/customer.html#create-a-customer) page to get the additional information about `createCustomer` parameters. If you want to place order as a new customer or a registered customer then you should get customer's authorization token. Use `generateCustomerToken` mutation for that. + **Request** + ```text mutation { - generateCustomerToken(email: "bobloblaw@example.com", password: "b0bl0bl@w") { + generateCustomerToken(email: "john.doe@example.com", password: "b1b2b3l@w+") { token } } ``` **Response** + ```json { - "data": { - "generateCustomerToken": { - "token": "hoyz7k697ubv5hcpq92yrtx39i7x10um" - } - } - } + "data": { + "generateCustomerToken": { + "token": "zuo7zor5jfldft2nmu2gtylnm8ui7e8t" + } + } +} ``` -See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) topic to get more details. +See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md index 8090536c419..291b056be3e 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md @@ -11,12 +11,13 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -Use the following query to get all available payment methods for your order. +Use the following `cart` query to get payment methods which are available for your order. **Request** + ```text -{ - cart(cart_id: "$maskedQuoteId") { +query { + cart(cart_id: "{{ CART_ID }}") { available_payment_methods { code title @@ -25,6 +26,68 @@ Use the following query to get all available payment methods for your order. } ``` +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + **Response** + ```json +{ + "data": { + "cart": { + "available_payment_methods": [ + { + "code": "checkmo", + "title": "Check / Money order" + } + ] + } + } +} ``` + +Use `setPaymentMethodOnCart` mutation query to set a payment method for your order. + +**Request** + +```text +mutation { + setPaymentMethodOnCart(input: { + cart_id: "{{ CART_ID }}" + payment_method: { + code: "checkmo" + } + }) { + cart { + selected_payment_method { + code + } + } + } +} +``` + +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`checkmo` - code of "Check / Money order" payment method + +**Response** + +If operation has been successfully executed you will get the code of selected payment method in the response. + +```json +{ + "data": { + "setPaymentMethodOnCart": { + "cart": { + "selected_payment_method": { + "code": "checkmo" + } + } + } + } +} +``` + +{:.bs-callout .bs-callout-info} +Send customer's authorization token in the `Authorization` parameter of the header if you set payment method to quote of a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md index 2f9f2132cd1..1fd2f4835bd 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md @@ -1,26 +1,22 @@ --- layout: tutorial group: graphql -title: Step 8. Place order +title: Step 10. Place order subtitle: GraphQl checkout tutorial return_to: title: GraphQl checkout tutorial url: graphql/tutorials/index.html -menu_order: 8 +menu_order: 10 contributor_name: Atwix contributor_link: https://www.atwix.com/ --- +Use `placeOrder` mutation query to place order. + **Request** ```text -mutation placeOrder( - $cart_id: String! -) { - placeOrder( - input: { - cart_id: $cart_id - } - ) { +mutation { + placeOrder(input: {cart_id: "A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h"}) { order { order_id } @@ -28,6 +24,21 @@ mutation placeOrder( } ``` +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + **Response** ```json +{ + "data": { + "placeOrder": { + "order": { + "order_id": "000000001" + } + } + } +} ``` + +{:.bs-callout .bs-callout-info} +Send customer's authorization token in the `Authorization` parameter of the header if you place order as a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md new file mode 100644 index 00000000000..2a2afd0de8b --- /dev/null +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md @@ -0,0 +1,49 @@ +--- +layout: tutorial +group: graphql +title: Step 9. Set quote email (for guest only) +subtitle: GraphQl checkout tutorial +return_to: + title: GraphQl checkout tutorial + url: graphql/tutorials/index.html +menu_order: 9 +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +{:.bs-callout .bs-callout-tip} +Skip this step if you place order as a registered customer. + +If you place order as a guest user you must set a quote email address. Use `setGuestEmailOnCart` mutation query for that. + +**Request** + +```text +mutation { + setGuestEmailOnCart(input: { + cart_id: "{{ CART_ID }}" + email: "guest_email@example.com" + }) { + cart { + guest_email + } + } +} +``` + +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + +**Response** + +```json +{ + "data": { + "setGuestEmailOnCart": { + "cart": { + "guest_email": "guest_email@example.com" + } + } + } +} +``` diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md index 275685dfe45..e8ae5326132 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -11,10 +11,101 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- +Use [setShippingAddressesOnCart]({{ page.baseurl }}/graphql/reference/quote.html#set-the-shipping-address-on-a-cart) mutation query to set a shipping address. GraphQl allows to add shipping address in the next ways: +- add new shipping address +- use for shipping a defined billing address +- use the existing customer's address from address book (available for registered customers) + +### New shipping address + **Request** + +The following mutation query adds new address to quote. + ```text +mutation { + setShippingAddressesOnCart( + input: { + cart_id: "A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h" + shipping_addresses: [ + { + address: { + firstname: "John" + lastname: "Doe" + company: "Company Name" + street: ["320 N Crescent Dr", "Beverly Hills"] + city: "Los Angeles" + region: "CA" + postcode: "90210" + country_code: "US" + telephone: "123-456-0000" + save_in_address_book: false + } + } + ] + } + ) { + cart { + shipping_addresses { + firstname + lastname + company + street + city + region + postcode + telephone + country { + code + label + } + address_type + } + } + } +} ``` +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + **Response** + +`setShippingAddressesOnCart` returns new address details if mutation query has been successfully executed. + ```json +{ + "data": { + "setShippingAddressesOnCart": { + "cart": { + "shipping_addresses": [ + { + "firstname": "John", + "lastname": "Doe", + "company": "Company Name", + "street": [ + "320 N Crescent Dr", + "Beverly Hills" + ], + "city": "Los Angeles", + "region": { + "code": "CA", + "label": "California" + }, + "postcode": "90210", + "telephone": "123-456-0000", + "country": { + "code": "US", + "label": "US" + }, + "address_type": "SHIPPING" + } + ] + } + } + } +} ``` + +{:.bs-callout .bs-callout-info} +Send customer's authorization token in the `Authorization` parameter of the header if you set shipping address for a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index e413a4b2e85..e62eb150c04 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -11,13 +11,23 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -Use `cart` query to retrieve available shipping methods for your quote. +`setShippingMethodsOnCart` mutation query is using to define a shipping method for your order and requires the next input parameters: + - `cart_id` + - `cart_address_id` + - `carrier_code` + - `method_code` + +### Get `cart_address_id` and available shipping methods + +Use `cart` query to retrieve `cart_address_id` and available shipping methods for your quote. + **Request** ```text query { - cart (cart_id: "{$maskedQuoteId}") { + cart (cart_id: "{{ CART_ID }}") { shipping_addresses { - available_shipping_methods { + address_id + available_shipping_methods { amount base_amount carrier_code @@ -27,28 +37,70 @@ query { method_title price_excl_tax price_incl_tax - } + } } } } ``` +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + **Response** -```json +```json +{ + "data": { + "cart": { + "shipping_addresses": [ + { + "address_id": 937, + "available_shipping_methods": [ + { + "amount": 5, + "base_amount": 5, + "carrier_code": "flatrate", + "carrier_title": "Flat Rate", + "error_message": "", + "method_code": "flatrate", + "method_title": "Fixed", + "price_excl_tax": 5, + "price_incl_tax": 5 + }, + { + "amount": 9.9, + "base_amount": 9.9, + "carrier_code": "ups", + "carrier_title": "United Parcel Service", + "error_message": "", + "method_code": "GND", + "method_title": "Ground", + "price_excl_tax": 9.9, + "price_incl_tax": 9.9 + } + ] + } + ] + } + } +} ``` -Use `setShippingMethodsOnCart` mutation query to define a shipping method for your order. +In the next tutorial steps value of `address_id` field - `937` will be mentioned as `{{ CART_SHIPPING_ADDRESS_ID }}`. + +### Specify shipping method for your order **Request** + The following mutation query assigns UPS "Ground" method. + ```text mutation { setShippingMethodsOnCart(input: { - cart_id: "$maskedQuoteId" + cart_id: "{{ CART_ID }}" shipping_methods: [ { - cart_address_id: $shippingAddressId + cart_address_id: {{ CART_SHIPPING_ADDRESS_ID }} carrier_code: "ups" method_code: "GND" } @@ -67,7 +119,31 @@ mutation { } ``` +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CART_SHIPPING_ADDRESS_ID }}` - shipping address ID from the query above. + **Response** -```json +```json +{ + "data": { + "setShippingMethodsOnCart": { + "cart": { + "shipping_addresses": [ + { + "selected_shipping_method": { + "carrier_code": "ups", + "method_code": "GND", + "label": "United Parcel Service - Ground" + } + } + ] + } + } + } +} ``` + +{:.bs-callout .bs-callout-info} +Send customer's authorization token in the `Authorization` parameter of the header if you set shipping method for a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md index ce5b99b2bb9..4a9a1050467 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md @@ -12,7 +12,9 @@ contributor_link: https://www.atwix.com/ --- **Request** -This mutation query creates an empty cart: + +The following mutation query creates an empty cart: + ```text mutation { createEmptyCart @@ -20,14 +22,16 @@ mutation { ``` **Response** + ```json { "data": { - "createEmptyCart": "gqjcFzgL8hNxxdrqLDEkMP487nOWBXOv" + "createEmptyCart": "A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h" } } ``` -If you create a shopping cart for the registered customer then you should send customer's authorization token in the `Authorization` parameter of the header: +In the next tutorial steps the unique shopping cart identifier - `A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h` will be mentioned as `{{ CART_ID }}`. -![GraphiQL Authorization Bearer]({{ page.baseurl }}/graphql/images/graphql-authorization.png) +{:.bs-callout .bs-callout-info} +Send customer's authorization token in the `Authorization` parameter of the header if you create a shopping cart for a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. diff --git a/guides/v2.3/graphql/tutorials/index.md b/guides/v2.3/graphql/tutorials/index.md index 6f7ceccc1d0..a0cbc93ea9d 100644 --- a/guides/v2.3/graphql/tutorials/index.md +++ b/guides/v2.3/graphql/tutorials/index.md @@ -9,14 +9,15 @@ This tutorial provides information how you can place order through GraphQl. Cust - As a logged-in user - As a guest user who does not create an account -Basically checkout process in GraphQl consists of the next steps: -- define customer (create customer or use registered customer account or place order as guest) -- create empty cart -- add a product to cart -- set shipping address -- set billing address -- set shipping method -- set payment method -- place order +Checkout process in GraphQl consists of the 10 steps. Some of them may be optional. -//setQuoteEmail \ No newline at end of file +[Step 1. Define customer]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-customer.html) (create customer, use a registered customer account or place order as guest) +[Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shopping-cart.html) +[Step 3. Add product to cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html) +[Step 4. Set shipping address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-address.html) +[Step 5. Set billing address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) +[Step 6. Set shipping method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-method.html) +[Step 7. Set payment method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-payment-method.html) +[Step 8. Apply coupon]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-coupon.html) +[Step 9. Set quote email (for guest only)]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-quote-email.html) +[Step 10. Place order]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-place-order.html) From 4c4d872317e370334374f9e2f287a4a18850ee47 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Tue, 16 Apr 2019 09:47:44 +0300 Subject: [PATCH 03/40] magento/devdocs#589: Add a tutorial for the checkout workflow --- .../checkout/checkout-billing-address.md | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index c12d9aafa14..f9cfca04102 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -11,6 +11,9 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- +{:.bs-callout .bs-callout-tip} +Billing address must always be set. + Use [setBillingAddressOnCart]({{ page.baseurl }}/graphql/reference/quote.html#set-the-billing-address-on-cart-attributes) mutation query to set a billing address. GraphQl allows to add billing address in the next ways: - add new billing address - add new billing address and set it as a shipping addresses @@ -96,7 +99,9 @@ where } ``` -### +### Add a new address for billing and shipping + +The following mutation adds a new billing address and sets it as a shipping address too. **Request** @@ -106,19 +111,19 @@ mutation { input: { cart_id: "{{ CART_ID }}" billing_address: { - address: { + address: { firstname: "John" - lastname: "Doe" - company: "Company Name" - street: ["320 N Crescent Dr", "Beverly Hills"] - city: "Los Angeles" - region: "CA" - postcode: "90210" - country_code: "US" - telephone: "123-456-0000" - save_in_address_book: false - } -# use_for_shipping: true + lastname: "Doe" + company: "Company Name" + street: ["320 N Crescent Dr", "Beverly Hills"] + city: "Los Angeles" + region: "CA" + postcode: "90210" + country_code: "US" + telephone: "123-456-0000" + save_in_address_book: false + } + use_for_shipping: true } } ) { @@ -157,6 +162,7 @@ mutation { ``` **Response** + ```json { "data": { @@ -204,7 +210,6 @@ mutation { } ``` - ### Use the existing customer address **Request** @@ -214,7 +219,7 @@ mutation { input: { cart_id: "{{ CART_ID }}" billing_address: { - customer_address_id: 937 + customer_address_id: {{ CUSTOMER_ADDRESS_ID }} } } ) { @@ -226,7 +231,9 @@ mutation { } } ``` + **Request** + ```text mutation { setBillingAddressOnCart( From 53de037678f24f90dd02a420ccaff9105d298d85 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Tue, 16 Apr 2019 12:28:03 +0300 Subject: [PATCH 04/40] magento/devdocs#589: Add a tutorial for the checkout workflow --- .../checkout/checkout-billing-address.md | 93 +++++++------------ 1 file changed, 34 insertions(+), 59 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index f9cfca04102..41ea285b1cf 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -212,26 +212,41 @@ mutation { ### Use the existing customer address +Use a query below to retrieve the list of customer addresses: + **Request** + ```text -mutation { - setBillingAddressOnCart( - input: { - cart_id: "{{ CART_ID }}" - billing_address: { - customer_address_id: {{ CUSTOMER_ADDRESS_ID }} - } +query { + customer { + addresses { + id + default_billing + default_shipping } - ) { - cart { - billing_address { - city - } + } +} +``` + +**Response** + +```text + "data": { + "customer": { + "addresses": [ + { + "id": 2, + "default_billing": true, + "default_shipping": true + } + ] } } } ``` +Define `customer_address_id` to assign the existing customer address. + **Request** ```text @@ -240,19 +255,7 @@ mutation { input: { cart_id: "{{ CART_ID }}" billing_address: { - address: { - firstname: "John" - lastname: "Doe" - company: "Company Name" - street: ["320 N Crescent Dr", "Beverly Hills"] - city: "Los Angeles" - region: "CA" - postcode: "90210" - country_code: "US" - telephone: "123-456-0000" - save_in_address_book: false - } -# use_for_shipping: true + customer_address_id: {{ CUSTOMER_ADDRESS_ID }} } } ) { @@ -271,26 +274,17 @@ mutation { } address_type } - shipping_addresses { - firstname - lastname - company - street - city - postcode - telephone - country { - code - label - } - address_type - } } } } ``` +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CUSTOMER_ADDRESS_ID }}` - customer address ID (value from `entity_id` field of `customer_address_entity` table). + **Response** + ```json { "data": { @@ -312,26 +306,7 @@ mutation { "label": "US" }, "address_type": "BILLING" - }, - "shipping_addresses": [ - { - "firstname": "John", - "lastname": "Doe", - "company": "Company Name", - "street": [ - "320 N Crescent Dr", - "Beverly Hills" - ], - "city": "Los Angeles", - "postcode": "90210", - "telephone": "123-456-0000", - "country": { - "code": "US", - "label": "US" - }, - "address_type": "SHIPPING" - } - ] + } } } } From bac65d8ff5a3ff7b5787d1b4537054580b9b1945 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Tue, 16 Apr 2019 23:36:20 +0300 Subject: [PATCH 05/40] magento/devdocs#589: Add a tutorial for the checkout workflow --- .../v2.3/graphql/tutorials/checkout/checkout-quote-email.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md index 2a2afd0de8b..cfd1b8eb173 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md @@ -22,10 +22,10 @@ If you place order as a guest user you must set a quote email address. Use `setG mutation { setGuestEmailOnCart(input: { cart_id: "{{ CART_ID }}" - email: "guest_email@example.com" + email: "guest@example.com" }) { cart { - guest_email + email } } } @@ -41,7 +41,7 @@ where "data": { "setGuestEmailOnCart": { "cart": { - "guest_email": "guest_email@example.com" + "email": "guest@example.com" } } } From 65bdfa50cb3670669cf6877a5f55ef159836d389 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Wed, 17 Apr 2019 17:14:19 +0300 Subject: [PATCH 06/40] magento/devdocs#589: Add a tutorial for the checkout workflow --- .../checkout/checkout-shipping-address.md | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md index e8ae5326132..7b740043b69 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -107,5 +107,134 @@ where } ``` +### Use for shipping a defined billing address + +See [Add a new address for billing and shipping]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) topic. + {:.bs-callout .bs-callout-info} Send customer's authorization token in the `Authorization` parameter of the header if you set shipping address for a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. + +### Use the existing customer's address + +Use a query below to retrieve the list of customer addresses: + +**Request** + +```text +query { + customer { + addresses { + id + default_billing + default_shipping + } + } +} +``` + +**Response** + +```text +{ + "data": { + "customer": { + "addresses": [ + { + "id": 2, + "default_billing": true, + "default_shipping": false + }, + { + "id": 3, + "default_billing": false, + "default_shipping": false + }, + { + "id": 4, + "default_billing": false, + "default_shipping": true + } + ] + } + } +} +``` + +Define `customer_address_id` to assign the existing customer address. + +**Request** + +```text +mutation { + setShippingAddressesOnCart( + input: { + cart_id: "{{ CART_ID }}" + shipping_addresses: { + customer_address_id: {{ CUSTOMER_ADDRESS_ID }} + } + } + ) { + cart { + shipping_addresses { + firstname + lastname + company + street + city + region { + code + label + } + postcode + telephone + country + { + code + label + } + address_type + } + } + } +} +``` + +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CUSTOMER_ADDRESS_ID }}` - customer address ID (value from `entity_id` field of `customer_address_entity` table). + +**Response** + +```json +{ + "data": { + "setShippingAddressesOnCart": { + "cart": { + "shipping_addresses": [ + { + "firstname": "John", + "lastname": "Doe", + "company": "Company Name", + "street": [ + "320 N Crescent Dr", + "Beverly Hills" + ], + "city": "Los Angeles", + "region": { + "code": "CA", + "label": "California" + }, + "postcode": "90210", + "telephone": "123-456-0000", + "country": { + "code": "US", + "label": "US" + }, + "address_type": "SHIPPING" + } + ] + } + } + } +} +``` From d73f31b07e45b30b377e0976bd93b3fa6e4aec52 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Fri, 19 Apr 2019 15:07:47 -0500 Subject: [PATCH 07/40] adding navigation --- _data/toc/graphql.yml | 11 +++++++--- .../checkout/checkout-add-product-to-cart.md | 13 +++++++----- .../checkout/checkout-billing-address.md | 17 ++++++++------- .../tutorials/checkout/checkout-coupon.md | 11 ++++++---- .../tutorials/checkout/checkout-customer.md | 15 +++++++------ .../checkout/checkout-payment-method.md | 17 ++++++++------- .../checkout/checkout-place-order.md | 13 +++++++----- .../checkout/checkout-quote-email.md | 15 +++++++------ .../checkout/checkout-shipping-address.md | 21 +++++++++++-------- .../checkout/checkout-shipping-method.md | 19 ++++++++++------- .../checkout/checkout-shopping-cart.md | 11 ++++++---- .../graphql/tutorials/{ => checkout}/index.md | 15 ++++++++++--- 12 files changed, 111 insertions(+), 67 deletions(-) rename guides/v2.3/graphql/tutorials/{ => checkout}/index.md (85%) diff --git a/_data/toc/graphql.yml b/_data/toc/graphql.yml index f1c445efdef..3f5de153dee 100644 --- a/_data/toc/graphql.yml +++ b/_data/toc/graphql.yml @@ -43,7 +43,7 @@ pages: children: - label: CMS endpoint url: /graphql/reference/cms.html - + - label: CustomAttributeMetadata endpoint url: /graphql/reference/custom-attribute-metadata.html @@ -94,6 +94,11 @@ pages: - label: Wishlist endpoint url: /graphql/reference/wishlist.html - + + - label: Tutorial + class: tutorial + url: /graphql/tutorials/checkout/index.html + include_versions: ["2.3"] + - label: Release Notes - url: /graphql/release-notes.html \ No newline at end of file + url: /graphql/release-notes.html diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index 4aed1956a48..9db0301dd45 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -2,11 +2,14 @@ layout: tutorial group: graphql title: Step 3. Add product to cart -subtitle: GraphQl checkout tutorial +subtitle: GraphQL checkout tutorial +level3_subgroup: graphql-checkout return_to: - title: GraphQl checkout tutorial - url: graphql/tutorials/index.html -menu_order: 3 + title: GraphQL Overview + url: graphql/index.html +menu_order: 30 +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- @@ -51,7 +54,7 @@ mutation { } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Response** diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index 41ea285b1cf..a2748ed38ae 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -2,11 +2,14 @@ layout: tutorial group: graphql title: Step 5. Set billing address -subtitle: GraphQl checkout tutorial +subtitle: GraphQL checkout tutorial +level3_subgroup: graphql-checkout return_to: - title: GraphQl checkout tutorial - url: graphql/tutorials/index.html -menu_order: 5 + title: GraphQL Overview + url: graphql/index.html +menu_order: 50 +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- @@ -66,7 +69,7 @@ mutation { } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Response** @@ -245,7 +248,7 @@ query { } ``` -Define `customer_address_id` to assign the existing customer address. +Define `customer_address_id` to assign the existing customer address. **Request** @@ -279,7 +282,7 @@ mutation { } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). `{{ CUSTOMER_ADDRESS_ID }}` - customer address ID (value from `entity_id` field of `customer_address_entity` table). diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md index 05c1275e2c6..b8e75c37ba1 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md @@ -2,11 +2,14 @@ layout: tutorial group: graphql title: Step 8. Apply coupon -subtitle: GraphQl checkout tutorial +subtitle: GraphQL checkout tutorial +level3_subgroup: graphql-checkout return_to: -title: GraphQl checkout tutorial -url: graphql/tutorials/index.html -menu_order: 8 + title: GraphQL Overview + url: graphql/index.html +menu_order: 80 +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md index 0a91aa26558..4963127d714 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md @@ -2,11 +2,14 @@ layout: tutorial group: graphql title: Step 1. Define customer -subtitle: GraphQl checkout tutorial +subtitle: GraphQL checkout tutorial +level3_subgroup: graphql-checkout return_to: - title: GraphQl checkout tutorial - url: graphql/tutorials/index.html -menu_order: 1 + title: GraphQL Overview + url: graphql/index.html +menu_order: 10 +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- @@ -74,7 +77,7 @@ mutation { token } } -``` +``` **Response** @@ -86,6 +89,6 @@ mutation { } } } -``` +``` See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md index 291b056be3e..0a0958ebc6d 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md @@ -2,11 +2,14 @@ layout: tutorial group: graphql title: Step 7. Set payment method -subtitle: GraphQl checkout tutorial +subtitle: GraphQL checkout tutorial +level3_subgroup: graphql-checkout return_to: - title: GraphQl checkout tutorial - url: graphql/tutorials/index.html -menu_order: 7 + title: GraphQL Overview + url: graphql/index.html +menu_order: 70 +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- @@ -26,7 +29,7 @@ query { } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Response** @@ -67,13 +70,13 @@ mutation { } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). `checkmo` - code of "Check / Money order" payment method **Response** -If operation has been successfully executed you will get the code of selected payment method in the response. +If operation has been successfully executed you will get the code of selected payment method in the response. ```json { diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md index 1fd2f4835bd..63528e0a69c 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md @@ -2,11 +2,14 @@ layout: tutorial group: graphql title: Step 10. Place order -subtitle: GraphQl checkout tutorial +subtitle: GraphQL checkout tutorial +level3_subgroup: graphql-checkout return_to: - title: GraphQl checkout tutorial - url: graphql/tutorials/index.html -menu_order: 10 + title: GraphQL Overview + url: graphql/index.html +menu_order: 100 +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- @@ -24,7 +27,7 @@ mutation { } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Response** diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md index cfd1b8eb173..31b8427fb2d 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md @@ -2,17 +2,20 @@ layout: tutorial group: graphql title: Step 9. Set quote email (for guest only) -subtitle: GraphQl checkout tutorial +subtitle: GraphQL checkout tutorial +level3_subgroup: graphql-checkout return_to: - title: GraphQl checkout tutorial - url: graphql/tutorials/index.html -menu_order: 9 + title: GraphQL Overview + url: graphql/index.html +menu_order: 90 +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- {:.bs-callout .bs-callout-tip} -Skip this step if you place order as a registered customer. +Skip this step if you place order as a registered customer. If you place order as a guest user you must set a quote email address. Use `setGuestEmailOnCart` mutation query for that. @@ -31,7 +34,7 @@ mutation { } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Response** diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md index 7b740043b69..3528a2c7ca8 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -2,11 +2,14 @@ layout: tutorial group: graphql title: Step 4. Set shipping address -subtitle: GraphQl checkout tutorial +subtitle: GraphQL checkout tutorial +level3_subgroup: graphql-checkout return_to: - title: GraphQl checkout tutorial - url: graphql/tutorials/index.html -menu_order: 4 + title: GraphQL Overview + url: graphql/index.html +menu_order: 40 +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- @@ -14,7 +17,7 @@ contributor_link: https://www.atwix.com/ Use [setShippingAddressesOnCart]({{ page.baseurl }}/graphql/reference/quote.html#set-the-shipping-address-on-a-cart) mutation query to set a shipping address. GraphQl allows to add shipping address in the next ways: - add new shipping address - use for shipping a defined billing address -- use the existing customer's address from address book (available for registered customers) +- use the existing customer's address from address book (available for registered customers) ### New shipping address @@ -66,7 +69,7 @@ mutation { } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Response** @@ -160,7 +163,7 @@ query { } ``` -Define `customer_address_id` to assign the existing customer address. +Define `customer_address_id` to assign the existing customer address. **Request** @@ -187,7 +190,7 @@ mutation { } postcode telephone - country + country { code label @@ -199,7 +202,7 @@ mutation { } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). `{{ CUSTOMER_ADDRESS_ID }}` - customer address ID (value from `entity_id` field of `customer_address_entity` table). diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index e62eb150c04..fa356e2958f 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -2,11 +2,14 @@ layout: tutorial group: graphql title: Step 6. Set shipping method -subtitle: GraphQl checkout tutorial +subtitle: GraphQL checkout tutorial +level3_subgroup: graphql-checkout return_to: - title: GraphQl checkout tutorial - url: graphql/tutorials/index.html -menu_order: 6 + title: GraphQL Overview + url: graphql/index.html +menu_order: 60 +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- @@ -43,7 +46,7 @@ query { } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Response** @@ -92,7 +95,7 @@ In the next tutorial steps value of `address_id` field - `937` will be mentioned **Request** -The following mutation query assigns UPS "Ground" method. +The following mutation query assigns UPS "Ground" method. ```text mutation { @@ -114,12 +117,12 @@ mutation { label } } - } + } } } ``` -where +where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). `{{ CART_SHIPPING_ADDRESS_ID }}` - shipping address ID from the query above. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md index 4a9a1050467..b9e6aa010b4 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md @@ -2,11 +2,14 @@ layout: tutorial group: graphql title: Step 2. Create empty cart -subtitle: GraphQl checkout tutorial +subtitle: GraphQL checkout tutorial +level3_subgroup: graphql-checkout return_to: - title: GraphQl checkout tutorial - url: graphql/tutorials/index.html -menu_order: 2 + title: GraphQL Overview + url: graphql/index.html +menu_order: 20 +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- diff --git a/guides/v2.3/graphql/tutorials/index.md b/guides/v2.3/graphql/tutorials/checkout/index.md similarity index 85% rename from guides/v2.3/graphql/tutorials/index.md rename to guides/v2.3/graphql/tutorials/checkout/index.md index a0cbc93ea9d..a5c2d576f4d 100644 --- a/guides/v2.3/graphql/tutorials/index.md +++ b/guides/v2.3/graphql/tutorials/checkout/index.md @@ -1,6 +1,15 @@ --- +layout: tutorial group: graphql -title: GraphQl checkout tutorial +title: GraphQL checkout tutorial +menu_title: Initial tasks +menu_order: 0 +level3_subgroup: graphql-checkout +return_to: + title: GraphQL Overview + url: graphql/index.html +functional_areas: + - Integration contributor_name: Atwix contributor_link: https://www.atwix.com/ --- @@ -8,8 +17,8 @@ contributor_link: https://www.atwix.com/ This tutorial provides information how you can place order through GraphQl. Customers can make purchases in two ways: - As a logged-in user - As a guest user who does not create an account - -Checkout process in GraphQl consists of the 10 steps. Some of them may be optional. + +Checkout process in GraphQl consists of the 10 steps. Some of them may be optional. [Step 1. Define customer]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-customer.html) (create customer, use a registered customer account or place order as guest) [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shopping-cart.html) From 39975780c486829a9583f21ca3d438814eeeda03 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Fri, 19 Apr 2019 15:30:27 -0500 Subject: [PATCH 08/40] Update graphql.yml Removed unnecessary line --- _data/toc/graphql.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/_data/toc/graphql.yml b/_data/toc/graphql.yml index 3f5de153dee..76ef7365599 100644 --- a/_data/toc/graphql.yml +++ b/_data/toc/graphql.yml @@ -98,7 +98,6 @@ pages: - label: Tutorial class: tutorial url: /graphql/tutorials/checkout/index.html - include_versions: ["2.3"] - label: Release Notes url: /graphql/release-notes.html From 1d194d35944c7b59c4a7a25a18b96baf7b9b935e Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Fri, 19 Apr 2019 23:35:00 +0300 Subject: [PATCH 09/40] magento/devdocs#589: Add a tutorial for the checkout workflow 1. Add info about coupon operations --- .../tutorials/checkout/checkout-coupon.md | 58 ++++++++++++++++++- .../checkout/checkout-place-order.md | 2 +- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md index b8e75c37ba1..f3e5d9b5222 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md @@ -14,26 +14,80 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -Use `applyCouponToCart` to apply a discount coupon to shopping cart. +Use [applyCouponToCart]({{ page.baseurl }}/graphql/reference/quote.html#apply-coupon-to-cart) to apply a discount coupon to shopping cart. **Request** ```text +mutation { + applyCouponToCart( + input: { + cart_id: "{{ CART_ID }}" + coupon_code: "{{ COUPON_CODE }}" + } + ) { + cart { + applied_coupon { + code + } + } + } +} ``` +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ COUPON_CODE }}` - coupon code. + **Response** ```json +{ + "data": { + "applyCouponToCart": { + "cart": { + "applied_coupon": { + "code": "{{ COUPON_CODE }}" + } + } + } + } +} ``` -Use `removeCouponFromCart` to remove a discount coupon from shopping cart. +Use [removeCouponFromCart]({{ page.baseurl }}/graphql/reference/quote.html#remove-coupon-from-cart) to remove a discount coupon from shopping cart. **Request** ```text +mutation { + removeCouponFromCart(input: { cart_id: "{{ CART_ID }}" }) { + cart { + applied_coupon { + code + } + } + } +} ``` +where +`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + **Response** ```json +{ + "data": { + "removeCouponFromCart": { + "cart": { + "applied_coupon": { + "code": "{{ COUPON_CODE }}" + } + } + } + } +} ``` + +where +`{{ COUPON_CODE }}` - coupon code that has been applied to cart. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md index 63528e0a69c..beab634aac7 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md @@ -19,7 +19,7 @@ Use `placeOrder` mutation query to place order. **Request** ```text mutation { - placeOrder(input: {cart_id: "A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h"}) { + placeOrder(input: {cart_id: "{{ CART_ID }}"}) { order { order_id } From ec245f18692351e4008e599b8a2c28e6633d9665 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Fri, 19 Apr 2019 23:44:02 +0300 Subject: [PATCH 10/40] magento/devdocs#: GraphQl Checkout Tutorial 1. Fix remove coupon response --- guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md index f3e5d9b5222..0449d5f5b10 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md @@ -81,13 +81,10 @@ where "removeCouponFromCart": { "cart": { "applied_coupon": { - "code": "{{ COUPON_CODE }}" + "applied_coupon": null } } } } } ``` - -where -`{{ COUPON_CODE }}` - coupon code that has been applied to cart. From ba75eda138958201d85dc535c2b90cc584eab851 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 21 Apr 2019 10:06:33 +0300 Subject: [PATCH 11/40] magento/devdocs#: GraphQl Checkout Tutorial 1. Made corrections for setShippingMethodsOnCart regarding https://github.com/magento/graphql-ce/pull/609 --- .../checkout/checkout-shipping-method.md | 76 ------------------- 1 file changed, 76 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index fa356e2958f..1e24ce11603 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -16,83 +16,9 @@ contributor_link: https://www.atwix.com/ `setShippingMethodsOnCart` mutation query is using to define a shipping method for your order and requires the next input parameters: - `cart_id` - - `cart_address_id` - `carrier_code` - `method_code` -### Get `cart_address_id` and available shipping methods - -Use `cart` query to retrieve `cart_address_id` and available shipping methods for your quote. - -**Request** -```text -query { - cart (cart_id: "{{ CART_ID }}") { - shipping_addresses { - address_id - available_shipping_methods { - amount - base_amount - carrier_code - carrier_title - error_message - method_code - method_title - price_excl_tax - price_incl_tax - } - } - } -} -``` - -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). - -**Response** - -```json -{ - "data": { - "cart": { - "shipping_addresses": [ - { - "address_id": 937, - "available_shipping_methods": [ - { - "amount": 5, - "base_amount": 5, - "carrier_code": "flatrate", - "carrier_title": "Flat Rate", - "error_message": "", - "method_code": "flatrate", - "method_title": "Fixed", - "price_excl_tax": 5, - "price_incl_tax": 5 - }, - { - "amount": 9.9, - "base_amount": 9.9, - "carrier_code": "ups", - "carrier_title": "United Parcel Service", - "error_message": "", - "method_code": "GND", - "method_title": "Ground", - "price_excl_tax": 9.9, - "price_incl_tax": 9.9 - } - ] - } - ] - } - } -} -``` - -In the next tutorial steps value of `address_id` field - `937` will be mentioned as `{{ CART_SHIPPING_ADDRESS_ID }}`. - -### Specify shipping method for your order - **Request** The following mutation query assigns UPS "Ground" method. @@ -103,7 +29,6 @@ mutation { cart_id: "{{ CART_ID }}" shipping_methods: [ { - cart_address_id: {{ CART_SHIPPING_ADDRESS_ID }} carrier_code: "ups" method_code: "GND" } @@ -124,7 +49,6 @@ mutation { where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). -`{{ CART_SHIPPING_ADDRESS_ID }}` - shipping address ID from the query above. **Response** From 5e6319315ccfce66784e49c0fbbe648c70737879 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 01:20:54 +0300 Subject: [PATCH 12/40] magento/devdocs#: GraphQl checkout tutorial --- .../checkout/checkout-add-product-to-cart.md | 3 +++ .../v2.3/graphql/tutorials/checkout/index.md | 20 +++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index 9db0301dd45..0c39e7c8a1c 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -24,7 +24,9 @@ GraphQL supports [7 types of product]({{ page.baseurl }}/graphql/reference/produ - gift card product (available for commerce version) **Request** + The following query adds a simple product into shopping cart. + ```text mutation { addSimpleProductsToCart( @@ -58,6 +60,7 @@ where `{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Response** + ```json { "data": { diff --git a/guides/v2.3/graphql/tutorials/checkout/index.md b/guides/v2.3/graphql/tutorials/checkout/index.md index a5c2d576f4d..e03ba7e739e 100644 --- a/guides/v2.3/graphql/tutorials/checkout/index.md +++ b/guides/v2.3/graphql/tutorials/checkout/index.md @@ -20,13 +20,13 @@ This tutorial provides information how you can place order through GraphQl. Cust Checkout process in GraphQl consists of the 10 steps. Some of them may be optional. -[Step 1. Define customer]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-customer.html) (create customer, use a registered customer account or place order as guest) -[Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shopping-cart.html) -[Step 3. Add product to cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html) -[Step 4. Set shipping address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-address.html) -[Step 5. Set billing address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) -[Step 6. Set shipping method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-method.html) -[Step 7. Set payment method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-payment-method.html) -[Step 8. Apply coupon]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-coupon.html) -[Step 9. Set quote email (for guest only)]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-quote-email.html) -[Step 10. Place order]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-place-order.html) +[Define customer]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-customer.html) (create customer, use a registered customer account or place order as guest) +[Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shopping-cart.html) +[Add product to cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html) +[Set shipping address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-address.html) +[Set billing address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) +[Set shipping method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-method.html) +[Set payment method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-payment-method.html) +[Apply coupon]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-coupon.html) +[Set quote email (for guest only)]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-quote-email.html) +[Place order]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-place-order.html) From f8186c92b94b6ec5a3e434d5481a3ff6d75f9bfc Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 01:57:04 +0300 Subject: [PATCH 13/40] magento/devdocs#: GraphQl checkout tutorial --- .../graphql/tutorials/checkout/checkout-shopping-cart.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md index b9e6aa010b4..7fc2cfa701d 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md @@ -1,7 +1,7 @@ --- layout: tutorial group: graphql -title: Step 2. Create empty cart +title: Step 2. Create an empty cart subtitle: GraphQL checkout tutorial level3_subgroup: graphql-checkout return_to: @@ -16,7 +16,7 @@ contributor_link: https://www.atwix.com/ **Request** -The following mutation query creates an empty cart: +The following mutation creates an empty cart: ```text mutation { @@ -34,7 +34,7 @@ mutation { } ``` -In the next tutorial steps the unique shopping cart identifier - `A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h` will be mentioned as `{{ CART_ID }}`. +In the subsequent tutorial steps, the unique shopping cart identifier `A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h` will be listed as `{{ CART_ID }}`. {:.bs-callout .bs-callout-info} Send customer's authorization token in the `Authorization` parameter of the header if you create a shopping cart for a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. From 73d278c5fd47d021b4fe61521115ffe6e7087366 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 02:10:30 +0300 Subject: [PATCH 14/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-add-product-to-cart.md --- .../tutorials/checkout/checkout-add-product-to-cart.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index 0c39e7c8a1c..fa5703fe2d0 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -83,6 +83,6 @@ where ``` {:.bs-callout .bs-callout-info} -Send customer's authorization token in the `Authorization` parameter of the header if you add product into shopping cart as a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. +If you add a product to the shopping cart as a registered customer, be sure to send customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more details. -Use `updateCartItems` mutation query to update shopping cart items and `removeItemFromCart` to remove product from the shopping cart. +Use the `updateCartItems` mutation to update shopping cart items and `removeItemFromCart` to remove a product from the shopping cart. From 64dc8bec353aa0d10df406c3dfa2c6b02281d87e Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 02:11:52 +0300 Subject: [PATCH 15/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-add-product-to-cart.md --- .../graphql/tutorials/checkout/checkout-add-product-to-cart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index fa5703fe2d0..a37eff466ce 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -25,7 +25,7 @@ GraphQL supports [7 types of product]({{ page.baseurl }}/graphql/reference/produ **Request** -The following query adds a simple product into shopping cart. +The following mutation adds a simple product into shopping cart. ```text mutation { From a15502431947ef266c387a4625da392ce680fbb4 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 02:17:19 +0300 Subject: [PATCH 16/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-billing-address.md --- .../checkout/checkout-billing-address.md | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index a2748ed38ae..736777302a7 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -15,16 +15,16 @@ contributor_link: https://www.atwix.com/ --- {:.bs-callout .bs-callout-tip} -Billing address must always be set. +You must always set the billing address to place an order. -Use [setBillingAddressOnCart]({{ page.baseurl }}/graphql/reference/quote.html#set-the-billing-address-on-cart-attributes) mutation query to set a billing address. GraphQl allows to add billing address in the next ways: -- add new billing address -- add new billing address and set it as a shipping addresses -- use the existing customer's address from address book (available for registered customers) +Use the [setBillingAddressOnCart]({{ page.baseurl }}/graphql/reference/quote.html#set-the-billing-address-on-cart-attributes) mutation to set a billing address. You can set the billing address in the following ways: +- Add a new billing address +- Add a new billing address and set it as the shipping addresses +- Use an address from the logged-in customer's address book -### New billing address +### Add a new billing address -The following mutation adds a new billing address. +The following mutation adds a new billing address. {{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -69,9 +69,6 @@ mutation { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). - **Response** ```json @@ -104,7 +101,7 @@ where ### Add a new address for billing and shipping -The following mutation adds a new billing address and sets it as a shipping address too. +The following mutation includes the `use_for_shipping` attribute, which allows the same address to be used as the billing and shipping address. **Request** @@ -213,9 +210,9 @@ mutation { } ``` -### Use the existing customer address +### Use an existing customer address -Use a query below to retrieve the list of customer addresses: +First, query the customer to return the list of address IDs. **Request** @@ -248,7 +245,9 @@ query { } ``` -Define `customer_address_id` to assign the existing customer address. +Set {{ CUSTOMER_ADDRESS_ID }} to an `id` returned in the query. + +{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** From 48bd36372b8ad2eacf48d805cd65fe7f9936956d Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 02:28:06 +0300 Subject: [PATCH 17/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-coupon.md --- .../tutorials/checkout/checkout-coupon.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md index 0449d5f5b10..c8eaa22bf82 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md @@ -1,7 +1,7 @@ --- layout: tutorial group: graphql -title: Step 8. Apply coupon +title: Step 8. Apply a coupon subtitle: GraphQL checkout tutorial level3_subgroup: graphql-checkout return_to: @@ -14,7 +14,11 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -Use [applyCouponToCart]({{ page.baseurl }}/graphql/reference/quote.html#apply-coupon-to-cart) to apply a discount coupon to shopping cart. +Use [applyCouponToCart]({{ page.baseurl }}/graphql/reference/quote-apply-coupon.html) to apply a discount coupon to the the specified `cart_id`. + +{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + +{{ COUPON_CODE }} is an existing Magento coupon code. It cannot be generated with GraphQL. **Request** @@ -35,9 +39,6 @@ mutation { } ``` -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). -`{{ COUPON_CODE }}` - coupon code. - **Response** ```json @@ -54,7 +55,7 @@ mutation { } ``` -Use [removeCouponFromCart]({{ page.baseurl }}/graphql/reference/quote.html#remove-coupon-from-cart) to remove a discount coupon from shopping cart. +Use [removeCouponFromCart]({{ page.baseurl }}/graphql/reference/quote-remove-coupon.html) to remove a discount coupon from the shopping cart. **Request** @@ -70,9 +71,6 @@ mutation { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). - **Response** ```json From baf472050c41f6dbe2a357fb5c3363e5a834b66c Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 02:34:22 +0300 Subject: [PATCH 18/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-customer.md --- .../graphql/tutorials/checkout/checkout-customer.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md index 4963127d714..0ef8ab0e685 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md @@ -1,7 +1,7 @@ --- layout: tutorial group: graphql -title: Step 1. Define customer +title: Step 1. Create a customer subtitle: GraphQL checkout tutorial level3_subgroup: graphql-checkout return_to: @@ -21,7 +21,7 @@ Customers can make purchases in two ways: {:.bs-callout .bs-callout-tip} Skip this step if you want to place order as a guest user. -If you want to place order as a new customer use `createCustomer` mutation to register new customer in the store. +To place order as a new customer, use the `createCustomer` mutation to register the new customer account in the store. **Request** @@ -65,9 +65,9 @@ mutation { } ``` -Check ["Customer endpoint"]({{ page.baseurl }}/graphql/reference/customer.html#create-a-customer) page to get the additional information about `createCustomer` parameters. +["Customer endpoint"]({{ page.baseurl }}/graphql/reference/customer.html#create-a-customer) describes additional `createCustomer` parameters. -If you want to place order as a new customer or a registered customer then you should get customer's authorization token. Use `generateCustomerToken` mutation for that. +To place an order as a new customer, you must get the customer's authorization token. Use the `generateCustomerToken` mutation for that. **Request** @@ -91,4 +91,4 @@ mutation { } ``` -See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. +["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) describes the mutation further. From 32467d84697635c836db8edca070b34dd316c8f7 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 02:39:29 +0300 Subject: [PATCH 19/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-payment-method.md --- .../checkout/checkout-payment-method.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md index 0a0958ebc6d..3d084bd8745 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md @@ -1,7 +1,7 @@ --- layout: tutorial group: graphql -title: Step 7. Set payment method +title: Step 7. Set the payment method subtitle: GraphQL checkout tutorial level3_subgroup: graphql-checkout return_to: @@ -14,7 +14,9 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -Use the following `cart` query to get payment methods which are available for your order. +Use the following `cart` query to determine which payment methods which are available for your order. + +{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -29,9 +31,6 @@ query { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). - **Response** ```json @@ -49,7 +48,7 @@ where } ``` -Use `setPaymentMethodOnCart` mutation query to set a payment method for your order. +Use the `setPaymentMethodOnCart` mutation to set the payment method for your order. The value `checkmo` ("Check / Money order" payment method code) was returned in the query. **Request** @@ -70,13 +69,9 @@ mutation { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). -`checkmo` - code of "Check / Money order" payment method - **Response** -If operation has been successfully executed you will get the code of selected payment method in the response. +If operation is successful, the response contains the code of the selected payment method. ```json { @@ -93,4 +88,4 @@ If operation has been successfully executed you will get the code of selected pa ``` {:.bs-callout .bs-callout-info} -Send customer's authorization token in the `Authorization` parameter of the header if you set payment method to quote of a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. From 1f42e9fbccf3d71fa1ecc4607be88b76aac2b817 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 02:56:47 +0300 Subject: [PATCH 20/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-place-order.md --- .../tutorials/checkout/checkout-place-order.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md index beab634aac7..f4881dc470a 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md @@ -14,9 +14,12 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -Use `placeOrder` mutation query to place order. +The `placeOrder` mutation places an order. + +{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** + ```text mutation { placeOrder(input: {cart_id: "{{ CART_ID }}"}) { @@ -27,10 +30,8 @@ mutation { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). - **Response** + ```json { "data": { @@ -44,4 +45,4 @@ where ``` {:.bs-callout .bs-callout-info} -Send customer's authorization token in the `Authorization` parameter of the header if you place order as a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. From 13f28b4aec66088cbdb40497fdcc27fe9ac62e26 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 03:00:12 +0300 Subject: [PATCH 21/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-quote-email.md --- .../tutorials/checkout/checkout-quote-email.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md index 31b8427fb2d..a48e7b22f84 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md @@ -1,7 +1,7 @@ --- layout: tutorial group: graphql -title: Step 9. Set quote email (for guest only) +title: Step 9. Set email on the cart (guest customers only) subtitle: GraphQL checkout tutorial level3_subgroup: graphql-checkout return_to: @@ -15,9 +15,11 @@ contributor_link: https://www.atwix.com/ --- {:.bs-callout .bs-callout-tip} -Skip this step if you place order as a registered customer. +Skip this step if you placed the order as a registered customer. -If you place order as a guest user you must set a quote email address. Use `setGuestEmailOnCart` mutation query for that. +If you place an order as a guest user, you must set a quote email address. Use the `setGuestEmailOnCart` mutation query for that. + +{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -34,9 +36,6 @@ mutation { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). - **Response** ```json From 589e90cd757261ccbf2454bc469dcc16ad831523 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 03:14:41 +0300 Subject: [PATCH 22/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-shipping-address.md --- .../checkout/checkout-shipping-address.md | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md index 3528a2c7ca8..4654bbf0f47 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -1,7 +1,7 @@ --- layout: tutorial group: graphql -title: Step 4. Set shipping address +title: Step 4. Set the shipping address subtitle: GraphQL checkout tutorial level3_subgroup: graphql-checkout return_to: @@ -14,16 +14,18 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -Use [setShippingAddressesOnCart]({{ page.baseurl }}/graphql/reference/quote.html#set-the-shipping-address-on-a-cart) mutation query to set a shipping address. GraphQl allows to add shipping address in the next ways: -- add new shipping address -- use for shipping a defined billing address -- use the existing customer's address from address book (available for registered customers) +Use [setShippingAddressesOnCart]({{ page.baseurl }}/graphql/reference/quote-shipping-method.html) mutation to set a shipping address. You can set the shipping address in the following ways: +- Add a new shipping address +- Assign the shipping address to be the same as the billing address +- Use an address already defined in the logged-in customer's address book -### New shipping address +### Create a new shipping address **Request** -The following mutation query adds new address to quote. +The following mutation adds a shipping address to the quote. + +{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). ```text mutation { @@ -69,12 +71,9 @@ mutation { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). - **Response** -`setShippingAddressesOnCart` returns new address details if mutation query has been successfully executed. +`setShippingAddressesOnCart` returns the new address details. ```json { @@ -110,16 +109,16 @@ where } ``` -### Use for shipping a defined billing address +### Assign the shipping address to be the same as the billing address See [Add a new address for billing and shipping]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) topic. {:.bs-callout .bs-callout-info} -Send customer's authorization token in the `Authorization` parameter of the header if you set shipping address for a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. ### Use the existing customer's address -Use a query below to retrieve the list of customer addresses: +First, query the customer to return the list of address IDs. **Request** @@ -163,7 +162,9 @@ query { } ``` -Define `customer_address_id` to assign the existing customer address. +Set {{ CUSTOMER_ADDRESS_ID }} to an `id` returned in the query. + +{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -202,10 +203,6 @@ mutation { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). -`{{ CUSTOMER_ADDRESS_ID }}` - customer address ID (value from `entity_id` field of `customer_address_entity` table). - **Response** ```json From 3579c4c5ce6bb6c2d9499c5cc5f322d8d961d3ce Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 03:20:07 +0300 Subject: [PATCH 23/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-shipping-method.md --- .../tutorials/checkout/checkout-shipping-method.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index 1e24ce11603..9d875766832 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -1,7 +1,7 @@ --- layout: tutorial group: graphql -title: Step 6. Set shipping method +title: Step 6. Set the shipping method subtitle: GraphQL checkout tutorial level3_subgroup: graphql-checkout return_to: @@ -14,11 +14,13 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -`setShippingMethodsOnCart` mutation query is using to define a shipping method for your order and requires the next input parameters: +The `setShippingMethodsOnCart` mutation defines the shipping methods for your order. It requires these input parameters: - `cart_id` - `carrier_code` - `method_code` +{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + **Request** The following mutation query assigns UPS "Ground" method. @@ -47,9 +49,6 @@ mutation { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). - **Response** ```json @@ -73,4 +72,4 @@ where ``` {:.bs-callout .bs-callout-info} -Send customer's authorization token in the `Authorization` parameter of the header if you set shipping method for a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. From 75fbc4e22962619e6381025e2d816f56063882e3 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 03:25:48 +0300 Subject: [PATCH 24/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-shopping-cart.md --- .../v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md index 7fc2cfa701d..ae970fcbd9c 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md @@ -37,4 +37,4 @@ mutation { In the subsequent tutorial steps, the unique shopping cart identifier `A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h` will be listed as `{{ CART_ID }}`. {:.bs-callout .bs-callout-info} -Send customer's authorization token in the `Authorization` parameter of the header if you create a shopping cart for a registered customer. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) to get more details. +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. From e5c01a803d7804b582c2444182878b0679240f1e Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Sun, 2 Jun 2019 03:43:33 +0300 Subject: [PATCH 25/40] magento/devdocs#: GraphQl checkout tutorial. Updates for index.md --- .../v2.3/graphql/tutorials/checkout/index.md | 38 +++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/index.md b/guides/v2.3/graphql/tutorials/checkout/index.md index e03ba7e739e..7b74a209753 100644 --- a/guides/v2.3/graphql/tutorials/checkout/index.md +++ b/guides/v2.3/graphql/tutorials/checkout/index.md @@ -18,15 +18,39 @@ This tutorial provides information how you can place order through GraphQl. Cust - As a logged-in user - As a guest user who does not create an account +The **10-step tutorial** generally takes **30 minutes**. + Checkout process in GraphQl consists of the 10 steps. Some of them may be optional. -[Define customer]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-customer.html) (create customer, use a registered customer account or place order as guest) -[Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shopping-cart.html) +[Create a customer]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-customer.html) (create customer, use a registered customer account or place order as guest) +[Create an empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shopping-cart.html) [Add product to cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html) -[Set shipping address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-address.html) +[Set the shipping address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-address.html) [Set billing address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) -[Set shipping method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-method.html) -[Set payment method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-payment-method.html) -[Apply coupon]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-coupon.html) -[Set quote email (for guest only)]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-quote-email.html) +[Set the shipping method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-method.html) +[Set the payment method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-payment-method.html) +[Apply a coupon]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-coupon.html) +[Set email on the cart (guest customers only)]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-quote-email.html) [Place order]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-place-order.html) + +### Before you begin +{:.tutorial-before} + +Complete the following prerequisites: + +* Install a Magento 2.1.3 (or later) instance with sample data. + + The sample data defines a functional store, called Luma, that sells fitness clothing and accessories. The store does not provide any sandbox accounts for testing credit card payments, so transactions will be simulated using an offline {% glossarytooltip 422b0fa8-b181-4c7c-93a2-c553abb34efd %}payment method{% endglossarytooltip %}. + +* Install a GraphQl client. You can use any GraphQl client to send calls to Magento. [GraphiQL](https://www.getpostman.com/) is recommended. + +* Learn about GraphQL, how it works, and how to use it. See [Introduction to GraphQL](https://graphql.org/learn/) for details. + +* Know how to generate a customer token. See [Get customer authorization token]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for details. + +* Find the Magento Merchant documentation. Refer to [Getting Started with {{site.data.var.ce}} 2.1](http://docs.magento.com/m2/ce/user_guide/getting-started.html) for information about the Luma store that is created when you install Magento with the sample data. + +### Other resources + +* [Order processing tutorial]({{ page.baseurl }}/rest/tutorials/orders/order-intro.html) shows a system integrator how REST APIs are used in the lifecycle of an order, including configuring a store and creating a customer; creating quotes, orders, invoices, and shipments; preparing for checkout; and more order-related tasks. +* [REST Tutorials]({{ page.baseurl }}/rest/tutorials/index.html) provides additional information about completing any Magento REST tutorial. From 4249345620ea0a1abf55a4ebf3cd63039d4f47f9 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Mon, 3 Jun 2019 19:04:09 +0300 Subject: [PATCH 26/40] magento/devdocs#: GraphQl checkout tutorial. Update product types --- .../tutorials/checkout/checkout-add-product-to-cart.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index a37eff466ce..af9501489d4 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -14,14 +14,9 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -GraphQL supports [7 types of product]({{ page.baseurl }}/graphql/reference/product-interface-implementations.html) which can be added into shopping cart: - - bundle product - - configurable product - - downloadable product - - grouped product +GraphQL supports [2 types of product]({{ page.baseurl }}/graphql/reference/product-interface-implementations.html) which can be added into shopping cart: - simple product - virtual product - - gift card product (available for commerce version) **Request** From a9812fed5a9c3efda3792f331daac5312d0eaec1 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Tue, 4 Jun 2019 01:48:41 +0300 Subject: [PATCH 27/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-billing-address.md --- .../tutorials/checkout/checkout-billing-address.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index 736777302a7..8437d2735a0 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -24,7 +24,7 @@ Use the [setBillingAddressOnCart]({{ page.baseurl }}/graphql/reference/quote.htm ### Add a new billing address -The following mutation adds a new billing address. {{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +The following mutation adds a new billing address. `{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -245,9 +245,9 @@ query { } ``` -Set {{ CUSTOMER_ADDRESS_ID }} to an `id` returned in the query. +Set `{{ CUSTOMER_ADDRESS_ID }}` to an `id` returned in the query. -{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -281,10 +281,6 @@ mutation { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). -`{{ CUSTOMER_ADDRESS_ID }}` - customer address ID (value from `entity_id` field of `customer_address_entity` table). - **Response** ```json From 71208e5153123ee63a9c3b3455a6624e38bb729b Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Tue, 4 Jun 2019 01:57:13 +0300 Subject: [PATCH 28/40] magento/devdocs#: GraphQl checkout tutorial. Updates for checkout-coupon.md, checkout-payment-method.md, checkout-place-order.md, checkout-quote-email.md, checkout-shipping-address.md, checkout-shipping-method.md and index.md . --- .../v2.3/graphql/tutorials/checkout/checkout-coupon.md | 4 ++-- .../tutorials/checkout/checkout-payment-method.md | 10 +++++----- .../graphql/tutorials/checkout/checkout-place-order.md | 8 ++++---- .../graphql/tutorials/checkout/checkout-quote-email.md | 2 +- .../tutorials/checkout/checkout-shipping-address.md | 8 ++++---- .../tutorials/checkout/checkout-shipping-method.md | 2 +- guides/v2.3/graphql/tutorials/checkout/index.md | 6 +++--- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md index c8eaa22bf82..d0ea8927d2c 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md @@ -16,9 +16,9 @@ contributor_link: https://www.atwix.com/ Use [applyCouponToCart]({{ page.baseurl }}/graphql/reference/quote-apply-coupon.html) to apply a discount coupon to the the specified `cart_id`. -{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). -{{ COUPON_CODE }} is an existing Magento coupon code. It cannot be generated with GraphQL. +`{{ COUPON_CODE }}` is an existing Magento coupon code. It cannot be generated with GraphQL. **Request** diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md index 3d084bd8745..9d08d1f641b 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md @@ -16,7 +16,7 @@ contributor_link: https://www.atwix.com/ Use the following `cart` query to determine which payment methods which are available for your order. -{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -50,6 +50,9 @@ query { Use the `setPaymentMethodOnCart` mutation to set the payment method for your order. The value `checkmo` ("Check / Money order" payment method code) was returned in the query. +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + **Request** ```text @@ -71,7 +74,7 @@ mutation { **Response** -If operation is successful, the response contains the code of the selected payment method. +If the operation is successful, the response contains the code of the selected payment method. ```json { @@ -86,6 +89,3 @@ If operation is successful, the response contains the code of the selected payme } } ``` - -{:.bs-callout .bs-callout-info} -For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md index f4881dc470a..9be5b0b614d 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md @@ -16,7 +16,10 @@ contributor_link: https://www.atwix.com/ The `placeOrder` mutation places an order. -{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). + +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. **Request** @@ -43,6 +46,3 @@ mutation { } } ``` - -{:.bs-callout .bs-callout-info} -For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md index a48e7b22f84..8301b993129 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md @@ -19,7 +19,7 @@ Skip this step if you placed the order as a registered customer. If you place an order as a guest user, you must set a quote email address. Use the `setGuestEmailOnCart` mutation query for that. -{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md index 4654bbf0f47..9a45182d770 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -27,6 +27,9 @@ The following mutation adds a shipping address to the quote. {{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + ```text mutation { setShippingAddressesOnCart( @@ -111,10 +114,7 @@ mutation { ### Assign the shipping address to be the same as the billing address -See [Add a new address for billing and shipping]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) topic. - -{:.bs-callout .bs-callout-info} -For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. +[Add a new address for billing and shipping]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) shows how to do this. ### Use the existing customer's address diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index 9d875766832..6d3b1af8f58 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -19,7 +19,7 @@ The `setShippingMethodsOnCart` mutation defines the shipping methods for your or - `carrier_code` - `method_code` -{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** diff --git a/guides/v2.3/graphql/tutorials/checkout/index.md b/guides/v2.3/graphql/tutorials/checkout/index.md index 7b74a209753..379c31a7e4e 100644 --- a/guides/v2.3/graphql/tutorials/checkout/index.md +++ b/guides/v2.3/graphql/tutorials/checkout/index.md @@ -20,7 +20,7 @@ This tutorial provides information how you can place order through GraphQl. Cust The **10-step tutorial** generally takes **30 minutes**. -Checkout process in GraphQl consists of the 10 steps. Some of them may be optional. +The checkout process in GraphQl consists of the 10 steps. Magento GraphQL is designed to run queries and perform actions on behalf of a customer. Magento GraphQLsh does not perform backend tasks, such as manage invoices or shipments. [Create a customer]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-customer.html) (create customer, use a registered customer account or place order as guest) [Create an empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shopping-cart.html) @@ -38,11 +38,11 @@ Checkout process in GraphQl consists of the 10 steps. Some of them may be option Complete the following prerequisites: -* Install a Magento 2.1.3 (or later) instance with sample data. +* Install a Magento 2.3 (or later) instance with sample data. The sample data defines a functional store, called Luma, that sells fitness clothing and accessories. The store does not provide any sandbox accounts for testing credit card payments, so transactions will be simulated using an offline {% glossarytooltip 422b0fa8-b181-4c7c-93a2-c553abb34efd %}payment method{% endglossarytooltip %}. -* Install a GraphQl client. You can use any GraphQl client to send calls to Magento. [GraphiQL](https://www.getpostman.com/) is recommended. +* Install a GraphQl client. You can use any GraphQl client to send calls to Magento. [GraphiQL](https://electronjs.org/apps/graphiql) is recommended. * Learn about GraphQL, how it works, and how to use it. See [Introduction to GraphQL](https://graphql.org/learn/) for details. From 5b2e9ebc227c28953b88bc21c694a29ba686c82c Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Tue, 4 Jun 2019 02:19:44 +0300 Subject: [PATCH 29/40] magento/devdocs#: GraphQl checkout tutorial. Add virtual product to cart --- .../checkout/checkout-add-product-to-cart.md | 75 +++++++++++++++++-- 1 file changed, 67 insertions(+), 8 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index af9501489d4..375a010896e 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -18,16 +18,23 @@ GraphQL supports [2 types of product]({{ page.baseurl }}/graphql/reference/produ - simple product - virtual product -**Request** +{:.bs-callout .bs-callout-info} +If you add a product to the shopping cart as a registered customer, be sure to send customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more details. + +`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). -The following mutation adds a simple product into shopping cart. +### Add a simple product into shopping cart + +The following mutation adds a **simple product** into shopping cart. + +**Request** ```text mutation { addSimpleProductsToCart( input: { cart_id: "{{ CART_ID }}" - cartItems: [ + cart_items: [ { data: { qty: 1 @@ -51,9 +58,6 @@ mutation { } ``` -where -`{{ CART_ID }}` - shopping cart unique ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). - **Response** ```json @@ -77,7 +81,62 @@ where } ``` -{:.bs-callout .bs-callout-info} -If you add a product to the shopping cart as a registered customer, be sure to send customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more details. +### Add a virtual product into shopping cart + +The following mutation adds a **virtual product** into shopping cart. + +**Request** + +```text +mutation { + addVirtualProductsToCart( + input: { + cart_id: "{{ CART_ID }}" + cart_items: [ + { + data: { + qty: 1 + sku: "virtual-product" + } + } + ] + } + ) { + cart { + items { + id + product { + sku + stock_status + } + qty + } + } + } +} +``` + +**Response** + +```json +{ + "data": { + "addVirtualProductsToCart": { + "cart": { + "items": [ + { + "id": "509", + "product": { + "sku": "virtual-product", + "stock_status": "IN_STOCK" + }, + "qty": 1 + } + ] + } + } + } +} +``` Use the `updateCartItems` mutation to update shopping cart items and `removeItemFromCart` to remove a product from the shopping cart. From b2b1e8a14e29435114dfa80ca27eac3ba3be9721 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Wed, 5 Jun 2019 02:17:49 +0300 Subject: [PATCH 30/40] magento/devdocs#: GraphQl checkout tutorial. --- .../tutorials/checkout/checkout-add-product-to-cart.md | 6 ++++++ .../tutorials/checkout/checkout-billing-address.md | 8 ++++++++ guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md | 8 ++++++++ .../v2.3/graphql/tutorials/checkout/checkout-customer.md | 4 ++++ .../graphql/tutorials/checkout/checkout-payment-method.md | 8 ++++++++ .../graphql/tutorials/checkout/checkout-place-order.md | 6 ++++++ .../graphql/tutorials/checkout/checkout-quote-email.md | 4 ++++ .../tutorials/checkout/checkout-shipping-address.md | 8 ++++++++ .../tutorials/checkout/checkout-shipping-method.md | 8 ++++++++ .../graphql/tutorials/checkout/checkout-shopping-cart.md | 4 ++++ 10 files changed, 64 insertions(+) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index 375a010896e..92d2557b5b6 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -140,3 +140,9 @@ mutation { ``` Use the `updateCartItems` mutation to update shopping cart items and `removeItemFromCart` to remove a product from the shopping cart. + +### Verify this step {#verify-step} + +1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. + +2. Go to shopping cart. All the items you added are displayed. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index 8437d2735a0..0f42b39f8c7 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -310,3 +310,11 @@ mutation { } } ``` + +### Verify this step {#verify-step} + +1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. + +2. Go to Checkout. + +3. Go to Review & Payments step. Billing Address form is populated with the entered address details. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md index d0ea8927d2c..17c76faa0e9 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md @@ -86,3 +86,11 @@ mutation { } } ``` + +### Verify this step {#verify-step} + +1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. + +2. Go to Checkout. + +3. Discount is displayed in the Order Summary block. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md index 0ef8ab0e685..ce2e6b5736e 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md @@ -92,3 +92,7 @@ mutation { ``` ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) describes the mutation further. + +### Verify this step {#verify-step} + +Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. You should be successfully logged in. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md index 9d08d1f641b..84e58e0c649 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md @@ -89,3 +89,11 @@ If the operation is successful, the response contains the code of the selected p } } ``` + +### Verify this step {#verify-step} + +1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. + +2. Go to Checkout. + +3. Selected payment method is displayed in the Payment Method section on the Review & Payments step. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md index 9be5b0b614d..f4c2a18c43d 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md @@ -46,3 +46,9 @@ mutation { } } ``` + +### Verify this step {#verify-step} + +1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. + +2. Go to My Account > My Orders. Created order is displayed for customer and on the back-end for administrator. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md index 8301b993129..0da8ec2a349 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md @@ -49,3 +49,7 @@ mutation { } } ``` + +### Verify this step {#verify-step} + +There are no additional verification steps. `quote`.`customer_email` is displayed for administrator on back-end side. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md index 9a45182d770..e6c63003739 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -238,3 +238,11 @@ mutation { } } ``` + +### Verify this step {#verify-step} + +1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. + +2. Go to Checkout. + +3. On the Shipping step Shipping Address form is populated with the entered address details. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index 6d3b1af8f58..ae4b7caad81 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -73,3 +73,11 @@ mutation { {:.bs-callout .bs-callout-info} For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + +### Verify this step {#verify-step} + +1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. + +2. Go to Checkout. + +3. Selected shipping method is displayed in the Shipping Methods section on the Shipping step. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md index ae970fcbd9c..fac1b3997a5 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md @@ -38,3 +38,7 @@ In the subsequent tutorial steps, the unique shopping cart identifier `A7jCcOmUj {:.bs-callout .bs-callout-info} For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + +### Verify this step {#verify-step} + +There are no additional verification steps. `quote`.`entity_id` value is not displayed on the website or in Admin. From d3fe88f69b0c0830e35c34722416c9d983e3311b Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Wed, 5 Jun 2019 23:36:03 +0300 Subject: [PATCH 31/40] magento/devdocs#: GraphQl checkout tutorial. --- .../checkout/checkout-add-product-to-cart.md | 15 ++++++++------- .../checkout/checkout-billing-address.md | 8 ++++---- guides/v2.3/graphql/tutorials/checkout/index.md | 12 +++++++----- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index 92d2557b5b6..90c2295d15e 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -15,15 +15,16 @@ contributor_link: https://www.atwix.com/ --- GraphQL supports [2 types of product]({{ page.baseurl }}/graphql/reference/product-interface-implementations.html) which can be added into shopping cart: - - simple product - - virtual product + + * simple product + * virtual product {:.bs-callout .bs-callout-info} -If you add a product to the shopping cart as a registered customer, be sure to send customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more details. +If you add a product to the shopping cart as a registered customer, be sure to send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more details. `{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). -### Add a simple product into shopping cart +## Add a simple product into shopping cart The following mutation adds a **simple product** into shopping cart. @@ -81,7 +82,7 @@ mutation { } ``` -### Add a virtual product into shopping cart +## Add a virtual product into shopping cart The following mutation adds a **virtual product** into shopping cart. @@ -141,8 +142,8 @@ mutation { Use the `updateCartItems` mutation to update shopping cart items and `removeItemFromCart` to remove a product from the shopping cart. -### Verify this step {#verify-step} +## Verify this step {#verify-step} 1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. -2. Go to shopping cart. All the items you added are displayed. +2. Go to the shopping cart. All the items you added are displayed. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index 0f42b39f8c7..e23dfa5aa37 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -22,7 +22,7 @@ Use the [setBillingAddressOnCart]({{ page.baseurl }}/graphql/reference/quote.htm - Add a new billing address and set it as the shipping addresses - Use an address from the logged-in customer's address book -### Add a new billing address +## Add a new billing address The following mutation adds a new billing address. `{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). @@ -99,7 +99,7 @@ mutation { } ``` -### Add a new address for billing and shipping +## Add a new address for billing and shipping The following mutation includes the `use_for_shipping` attribute, which allows the same address to be used as the billing and shipping address. @@ -210,7 +210,7 @@ mutation { } ``` -### Use an existing customer address +## Use an existing customer address First, query the customer to return the list of address IDs. @@ -311,7 +311,7 @@ mutation { } ``` -### Verify this step {#verify-step} +## Verify this step {#verify-step} 1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. diff --git a/guides/v2.3/graphql/tutorials/checkout/index.md b/guides/v2.3/graphql/tutorials/checkout/index.md index 379c31a7e4e..25e23a4448e 100644 --- a/guides/v2.3/graphql/tutorials/checkout/index.md +++ b/guides/v2.3/graphql/tutorials/checkout/index.md @@ -14,13 +14,14 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -This tutorial provides information how you can place order through GraphQl. Customers can make purchases in two ways: -- As a logged-in user -- As a guest user who does not create an account +This tutorial describes how to place order through GraphQl. Customers can make purchases in two ways: + +* As a logged-in user +* As a guest user who does not create an account The **10-step tutorial** generally takes **30 minutes**. -The checkout process in GraphQl consists of the 10 steps. Magento GraphQL is designed to run queries and perform actions on behalf of a customer. Magento GraphQLsh does not perform backend tasks, such as manage invoices or shipments. +The checkout process in GraphQl consists of 10 steps. Magento GraphQL is designed to run queries and perform actions on behalf of a customer. Magento GraphQL does not perform backend tasks, such as manage invoices or shipments. [Create a customer]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-customer.html) (create customer, use a registered customer account or place order as guest) [Create an empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shopping-cart.html) @@ -48,9 +49,10 @@ Complete the following prerequisites: * Know how to generate a customer token. See [Get customer authorization token]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for details. -* Find the Magento Merchant documentation. Refer to [Getting Started with {{site.data.var.ce}} 2.1](http://docs.magento.com/m2/ce/user_guide/getting-started.html) for information about the Luma store that is created when you install Magento with the sample data. +* Find the Magento Merchant documentation. Refer to [Getting Started with {{site.data.var.ce}}](http://docs.magento.com/m2/ce/user_guide/getting-started.html) for information about the Luma store that is created when you install Magento with the sample data. ### Other resources * [Order processing tutorial]({{ page.baseurl }}/rest/tutorials/orders/order-intro.html) shows a system integrator how REST APIs are used in the lifecycle of an order, including configuring a store and creating a customer; creating quotes, orders, invoices, and shipments; preparing for checkout; and more order-related tasks. + * [REST Tutorials]({{ page.baseurl }}/rest/tutorials/index.html) provides additional information about completing any Magento REST tutorial. From 2b1ad2e7327d4fafb29235b29c1065ed8ae88bae Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Wed, 5 Jun 2019 23:39:54 +0300 Subject: [PATCH 32/40] magento/devdocs#: GraphQl checkout tutorial. --- .../v2.3/graphql/tutorials/checkout/checkout-shipping-method.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index ae4b7caad81..4f02e8847fd 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -74,7 +74,7 @@ mutation { {:.bs-callout .bs-callout-info} For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. -### Verify this step {#verify-step} +## Verify this step {#verify-step} 1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. From 846385557e43d3964673b1f5362ffcee521165de Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Thu, 6 Jun 2019 00:00:20 +0300 Subject: [PATCH 33/40] magento/devdocs#: GraphQl checkout tutorial. --- .../checkout/checkout-billing-address.md | 13 +++++----- .../tutorials/checkout/checkout-coupon.md | 4 +-- .../tutorials/checkout/checkout-customer.md | 7 +++--- .../checkout/checkout-payment-method.md | 4 +-- .../checkout/checkout-place-order.md | 4 +-- .../checkout/checkout-quote-email.md | 2 +- .../checkout/checkout-shipping-address.md | 25 ++++++++++--------- .../checkout/checkout-shipping-method.md | 9 ++++--- .../checkout/checkout-shopping-cart.md | 12 +++++---- 9 files changed, 43 insertions(+), 37 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index e23dfa5aa37..2a209e1cfa5 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -18,9 +18,10 @@ contributor_link: https://www.atwix.com/ You must always set the billing address to place an order. Use the [setBillingAddressOnCart]({{ page.baseurl }}/graphql/reference/quote.html#set-the-billing-address-on-cart-attributes) mutation to set a billing address. You can set the billing address in the following ways: -- Add a new billing address -- Add a new billing address and set it as the shipping addresses -- Use an address from the logged-in customer's address book + +* Add a new billing address +* Add a new billing address and set it as the shipping addresses +* Use an address from the logged-in customer's address book ## Add a new billing address @@ -101,7 +102,7 @@ mutation { ## Add a new address for billing and shipping -The following mutation includes the `use_for_shipping` attribute, which allows the same address to be used as the billing and shipping address. +The following mutation includes the `use_for_shipping` attribute, which allows the same address to be used for billing and shipping. **Request** @@ -245,7 +246,7 @@ query { } ``` -Set `{{ CUSTOMER_ADDRESS_ID }}` to an `id` returned in the query. +Set `{{ CUSTOMER_ADDRESS_ID }}` to an `id` returned in the query. `{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). @@ -317,4 +318,4 @@ mutation { 2. Go to Checkout. -3. Go to Review & Payments step. Billing Address form is populated with the entered address details. +3. Go to the Review & Payments step. The Billing Address form is populated with the address details you entered. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md index 17c76faa0e9..a6715cff46f 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md @@ -87,10 +87,10 @@ mutation { } ``` -### Verify this step {#verify-step} +## Verify this step {#verify-step} 1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. 2. Go to Checkout. -3. Discount is displayed in the Order Summary block. +3. The discount is displayed in the Order Summary block. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md index ce2e6b5736e..13408f9137c 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md @@ -15,8 +15,9 @@ contributor_link: https://www.atwix.com/ --- Customers can make purchases in two ways: -- As a logged-in user -- As a guest user who does not create an account + +* As a logged-in user +* As a guest user who does not create an account {:.bs-callout .bs-callout-tip} Skip this step if you want to place order as a guest user. @@ -93,6 +94,6 @@ mutation { ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) describes the mutation further. -### Verify this step {#verify-step} +## Verify this step {#verify-step} Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. You should be successfully logged in. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md index 84e58e0c649..5ed29365595 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md @@ -90,10 +90,10 @@ If the operation is successful, the response contains the code of the selected p } ``` -### Verify this step {#verify-step} +## Verify this step {#verify-step} 1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. 2. Go to Checkout. -3. Selected payment method is displayed in the Payment Method section on the Review & Payments step. +3. The selected payment method is displayed in the Payment Method section on the Review & Payments step. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md index f4c2a18c43d..1b9c3c35576 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md @@ -47,8 +47,8 @@ mutation { } ``` -### Verify this step {#verify-step} +## Verify this step {#verify-step} 1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. -2. Go to My Account > My Orders. Created order is displayed for customer and on the back-end for administrator. +2. Go to **My Account** > **My Orders**. The order you created is displayed. The order is also displayed on the Orders grid (**Sales** > **Orders** in the Magento Admin. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md index 0da8ec2a349..f0f80b34171 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md @@ -50,6 +50,6 @@ mutation { } ``` -### Verify this step {#verify-step} +## Verify this step {#verify-step} There are no additional verification steps. `quote`.`customer_email` is displayed for administrator on back-end side. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md index e6c63003739..9ebe75916e9 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -14,18 +14,19 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -Use [setShippingAddressesOnCart]({{ page.baseurl }}/graphql/reference/quote-shipping-method.html) mutation to set a shipping address. You can set the shipping address in the following ways: -- Add a new shipping address -- Assign the shipping address to be the same as the billing address -- Use an address already defined in the logged-in customer's address book +Use the [setShippingAddressesOnCart]({{ page.baseurl }}/graphql/reference/quote-shipping-method.html) mutation to set a shipping address. You can set the shipping address in the following ways: -### Create a new shipping address +* Add a new shipping address +* Assign the shipping address to be the same as the billing address +* Use an address already defined in the logged-in customer's address book + +## Create a new shipping address **Request** The following mutation adds a shipping address to the quote. -{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). {:.bs-callout .bs-callout-info} For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. @@ -112,11 +113,11 @@ mutation { } ``` -### Assign the shipping address to be the same as the billing address +## Assign the shipping address to be the same as the billing address [Add a new address for billing and shipping]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) shows how to do this. -### Use the existing customer's address +## Use the existing customer's address First, query the customer to return the list of address IDs. @@ -162,9 +163,9 @@ query { } ``` -Set {{ CUSTOMER_ADDRESS_ID }} to an `id` returned in the query. +Set `{{ CUSTOMER_ADDRESS_ID }}` to an `id` returned in the query. -{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -239,10 +240,10 @@ mutation { } ``` -### Verify this step {#verify-step} +## Verify this step {#verify-step} 1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. 2. Go to Checkout. -3. On the Shipping step Shipping Address form is populated with the entered address details. +3. On the Shipping step, the Shipping Address form contains the address details you entered. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index 4f02e8847fd..adafe27fc88 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -15,9 +15,10 @@ contributor_link: https://www.atwix.com/ --- The `setShippingMethodsOnCart` mutation defines the shipping methods for your order. It requires these input parameters: - - `cart_id` - - `carrier_code` - - `method_code` + + * `cart_id` + * `carrier_code` + * `method_code` `{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). @@ -80,4 +81,4 @@ For logged-in customers, send the customer's authorization token in the `Authori 2. Go to Checkout. -3. Selected shipping method is displayed in the Shipping Methods section on the Shipping step. +3. The selected shipping method is displayed in the Shipping Methods section on the Shipping step. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md index fac1b3997a5..84962e99122 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md @@ -14,6 +14,11 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- +The `createEmptyCart` mutation creates an empty shopping cart and generates a cart ID. + +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the Authorization parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + **Request** The following mutation creates an empty cart: @@ -36,9 +41,6 @@ mutation { In the subsequent tutorial steps, the unique shopping cart identifier `A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h` will be listed as `{{ CART_ID }}`. -{:.bs-callout .bs-callout-info} -For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. - -### Verify this step {#verify-step} +## Verify this step {#verify-step} -There are no additional verification steps. `quote`.`entity_id` value is not displayed on the website or in Admin. +There are no additional verification steps. The values of `quote` and `entity_id` value are not displayed on the website or in the Magento Admin. From 40e4ffed0cad0a63c64a90df83c3ec247dbdb117 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Mon, 10 Jun 2019 13:17:24 +0300 Subject: [PATCH 34/40] magento/devdocs#: GraphQl checkout tutorial. --- .../checkout/checkout-add-product-to-cart.md | 6 +++--- .../tutorials/checkout/checkout-billing-address.md | 14 +++++++------- .../graphql/tutorials/checkout/checkout-coupon.md | 12 ++++++------ .../tutorials/checkout/checkout-customer.md | 6 +++--- .../tutorials/checkout/checkout-payment-method.md | 6 +++--- .../tutorials/checkout/checkout-place-order.md | 4 ++-- .../tutorials/checkout/checkout-quote-email.md | 4 ++-- .../checkout/checkout-shipping-address.md | 10 +++++----- .../tutorials/checkout/checkout-shipping-method.md | 4 ++-- .../tutorials/checkout/checkout-shopping-cart.md | 2 +- guides/v2.3/graphql/tutorials/checkout/index.md | 2 +- 11 files changed, 35 insertions(+), 35 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index 90c2295d15e..dc5d69be07a 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -22,7 +22,7 @@ GraphQL supports [2 types of product]({{ page.baseurl }}/graphql/reference/produ {:.bs-callout .bs-callout-info} If you add a product to the shopping cart as a registered customer, be sure to send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more details. -`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). ## Add a simple product into shopping cart @@ -34,7 +34,7 @@ The following mutation adds a **simple product** into shopping cart. mutation { addSimpleProductsToCart( input: { - cart_id: "{{ CART_ID }}" + cart_id: "{ CART_ID }" cart_items: [ { data: { @@ -92,7 +92,7 @@ The following mutation adds a **virtual product** into shopping cart. mutation { addVirtualProductsToCart( input: { - cart_id: "{{ CART_ID }}" + cart_id: "{ CART_ID }" cart_items: [ { data: { diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index 2a209e1cfa5..9e30398e987 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -25,7 +25,7 @@ Use the [setBillingAddressOnCart]({{ page.baseurl }}/graphql/reference/quote.htm ## Add a new billing address -The following mutation adds a new billing address. `{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +The following mutation adds a new billing address. `{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -33,7 +33,7 @@ The following mutation adds a new billing address. `{{ CART_ID }}` is the unique mutation { setBillingAddressOnCart( input: { - cart_id: "{{ CART_ID }}" + cart_id: "{ CART_ID }" billing_address: { address: { firstname: "John" @@ -110,7 +110,7 @@ The following mutation includes the `use_for_shipping` attribute, which allows t mutation { setBillingAddressOnCart( input: { - cart_id: "{{ CART_ID }}" + cart_id: "{ CART_ID }" billing_address: { address: { firstname: "John" @@ -246,9 +246,9 @@ query { } ``` -Set `{{ CUSTOMER_ADDRESS_ID }}` to an `id` returned in the query. +Set `{ CUSTOMER_ADDRESS_ID }` to an `id` returned in the query. -`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -256,9 +256,9 @@ Set `{{ CUSTOMER_ADDRESS_ID }}` to an `id` returned in the query. mutation { setBillingAddressOnCart( input: { - cart_id: "{{ CART_ID }}" + cart_id: "{ CART_ID }" billing_address: { - customer_address_id: {{ CUSTOMER_ADDRESS_ID }} + customer_address_id: { CUSTOMER_ADDRESS_ID } } } ) { diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md index a6715cff46f..0966bf607f8 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md @@ -16,9 +16,9 @@ contributor_link: https://www.atwix.com/ Use [applyCouponToCart]({{ page.baseurl }}/graphql/reference/quote-apply-coupon.html) to apply a discount coupon to the the specified `cart_id`. -`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). -`{{ COUPON_CODE }}` is an existing Magento coupon code. It cannot be generated with GraphQL. +`{ COUPON_CODE }` is an existing Magento coupon code. It cannot be generated with GraphQL. **Request** @@ -26,8 +26,8 @@ Use [applyCouponToCart]({{ page.baseurl }}/graphql/reference/quote-apply-coupon. mutation { applyCouponToCart( input: { - cart_id: "{{ CART_ID }}" - coupon_code: "{{ COUPON_CODE }}" + cart_id: "{ CART_ID }" + coupon_code: "{ COUPON_CODE }" } ) { cart { @@ -47,7 +47,7 @@ mutation { "applyCouponToCart": { "cart": { "applied_coupon": { - "code": "{{ COUPON_CODE }}" + "code": "{ COUPON_CODE }" } } } @@ -61,7 +61,7 @@ Use [removeCouponFromCart]({{ page.baseurl }}/graphql/reference/quote-remove-cou ```text mutation { - removeCouponFromCart(input: { cart_id: "{{ CART_ID }}" }) { + removeCouponFromCart(input: { cart_id: "{ CART_ID }" }) { cart { applied_coupon { code diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md index 13408f9137c..f902cc7f66b 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-customer.md @@ -19,11 +19,11 @@ Customers can make purchases in two ways: * As a logged-in user * As a guest user who does not create an account -{:.bs-callout .bs-callout-tip} -Skip this step if you want to place order as a guest user. - To place order as a new customer, use the `createCustomer` mutation to register the new customer account in the store. +{:.bs-callout .bs-callout-info} +Skip this step if you want to place order as a guest user. + **Request** ```text diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md index 5ed29365595..7862c243094 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md @@ -16,13 +16,13 @@ contributor_link: https://www.atwix.com/ Use the following `cart` query to determine which payment methods which are available for your order. -`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** ```text query { - cart(cart_id: "{{ CART_ID }}") { + cart(cart_id: "{ CART_ID }") { available_payment_methods { code title @@ -58,7 +58,7 @@ For logged-in customers, send the customer's authorization token in the `Authori ```text mutation { setPaymentMethodOnCart(input: { - cart_id: "{{ CART_ID }}" + cart_id: "{ CART_ID }" payment_method: { code: "checkmo" } diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md index 1b9c3c35576..54e98ea39f8 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md @@ -16,7 +16,7 @@ contributor_link: https://www.atwix.com/ The `placeOrder` mutation places an order. -`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). {:.bs-callout .bs-callout-info} For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. @@ -25,7 +25,7 @@ For logged-in customers, send the customer's authorization token in the `Authori ```text mutation { - placeOrder(input: {cart_id: "{{ CART_ID }}"}) { + placeOrder(input: {cart_id: "{ CART_ID }"}) { order { order_id } diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md index f0f80b34171..3f3e6413035 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-quote-email.md @@ -19,14 +19,14 @@ Skip this step if you placed the order as a registered customer. If you place an order as a guest user, you must set a quote email address. Use the `setGuestEmailOnCart` mutation query for that. -`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** ```text mutation { setGuestEmailOnCart(input: { - cart_id: "{{ CART_ID }}" + cart_id: "{ CART_ID }" email: "guest@example.com" }) { cart { diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md index 9ebe75916e9..8f77166d007 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -26,7 +26,7 @@ Use the [setShippingAddressesOnCart]({{ page.baseurl }}/graphql/reference/quote- The following mutation adds a shipping address to the quote. -`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). {:.bs-callout .bs-callout-info} For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. @@ -163,9 +163,9 @@ query { } ``` -Set `{{ CUSTOMER_ADDRESS_ID }}` to an `id` returned in the query. +Set `{ CUSTOMER_ADDRESS_ID }` to an `id` returned in the query. -`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -173,9 +173,9 @@ Set `{{ CUSTOMER_ADDRESS_ID }}` to an `id` returned in the query. mutation { setShippingAddressesOnCart( input: { - cart_id: "{{ CART_ID }}" + cart_id: "{ CART_ID }" shipping_addresses: { - customer_address_id: {{ CUSTOMER_ADDRESS_ID }} + customer_address_id: { CUSTOMER_ADDRESS_ID } } } ) { diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index adafe27fc88..1d7acac8643 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -20,7 +20,7 @@ The `setShippingMethodsOnCart` mutation defines the shipping methods for your or * `carrier_code` * `method_code` -`{{ CART_ID }}` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +`{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** @@ -29,7 +29,7 @@ The following mutation query assigns UPS "Ground" method. ```text mutation { setShippingMethodsOnCart(input: { - cart_id: "{{ CART_ID }}" + cart_id: "{ CART_ID }" shipping_methods: [ { carrier_code: "ups" diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md index 84962e99122..a73e1f6e03d 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shopping-cart.md @@ -39,7 +39,7 @@ mutation { } ``` -In the subsequent tutorial steps, the unique shopping cart identifier `A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h` will be listed as `{{ CART_ID }}`. +In the subsequent tutorial steps, the unique shopping cart identifier `A7jCcOmUjjCh7MxDIzu1SeqdqETqEa5h` will be listed as `{ CART_ID }`. ## Verify this step {#verify-step} diff --git a/guides/v2.3/graphql/tutorials/checkout/index.md b/guides/v2.3/graphql/tutorials/checkout/index.md index 25e23a4448e..d866fa1d366 100644 --- a/guides/v2.3/graphql/tutorials/checkout/index.md +++ b/guides/v2.3/graphql/tutorials/checkout/index.md @@ -14,7 +14,7 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -This tutorial describes how to place order through GraphQl. Customers can make purchases in two ways: +This tutorial describes how to place an order through GraphQl. Customers can make purchases in two ways: * As a logged-in user * As a guest user who does not create an account From b12304ef481b9b09e9a2fed3968d0f2c8f029cc3 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Mon, 10 Jun 2019 13:29:49 +0300 Subject: [PATCH 35/40] magento/devdocs#: GraphQl checkout tutorial. --- .../graphql/tutorials/checkout/checkout-add-product-to-cart.md | 2 +- .../graphql/tutorials/checkout/checkout-shipping-address.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index dc5d69be07a..4e1cf927ea0 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -14,7 +14,7 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -GraphQL supports [2 types of product]({{ page.baseurl }}/graphql/reference/product-interface-implementations.html) which can be added into shopping cart: +GraphQL supports [two types of product]({{ page.baseurl }}/graphql/reference/product-interface-implementations.html) which can be added into shopping cart: * simple product * virtual product diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md index 8f77166d007..19e61090c97 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -119,7 +119,7 @@ mutation { ## Use the existing customer's address -First, query the customer to return the list of address IDs. +First, query the customer to return a list of address IDs. **Request** From a39247929a8dee28392e9fbed520c66f58db2f71 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Mon, 24 Jun 2019 19:07:17 +0300 Subject: [PATCH 36/40] magento/devdocs#: GraphQl checkout tutorial. --- .../checkout/checkout-add-product-to-cart.md | 18 ++++++++++++------ .../checkout/checkout-billing-address.md | 3 +++ .../tutorials/checkout/checkout-coupon.md | 6 ++++++ .../checkout/checkout-payment-method.md | 10 ++++++++-- .../tutorials/checkout/checkout-place-order.md | 4 ++-- .../checkout/checkout-shipping-address.md | 4 ++-- .../checkout/checkout-shipping-method.md | 6 +++--- 7 files changed, 36 insertions(+), 15 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index 4e1cf927ea0..5570647b17e 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -30,6 +30,9 @@ The following mutation adds a **simple product** into shopping cart. **Request** +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + ```text mutation { addSimpleProductsToCart( @@ -38,7 +41,7 @@ mutation { cart_items: [ { data: { - qty: 1 + quantity: 1 sku: "simple-product" } } @@ -52,7 +55,7 @@ mutation { sku stock_status } - qty + quantity } } } @@ -73,7 +76,7 @@ mutation { "sku": "simple-product", "stock_status": "IN_STOCK" }, - "qty": 1 + "quantity": 1 } ] } @@ -88,6 +91,9 @@ The following mutation adds a **virtual product** into shopping cart. **Request** +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + ```text mutation { addVirtualProductsToCart( @@ -96,7 +102,7 @@ mutation { cart_items: [ { data: { - qty: 1 + quantity: 1 sku: "virtual-product" } } @@ -110,7 +116,7 @@ mutation { sku stock_status } - qty + quantity } } } @@ -131,7 +137,7 @@ mutation { "sku": "virtual-product", "stock_status": "IN_STOCK" }, - "qty": 1 + "quantity": 1 } ] } diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index 9e30398e987..1bca9c803c2 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -29,6 +29,9 @@ The following mutation adds a new billing address. `{ CART_ID }` is the unique s **Request** +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + ```text mutation { setBillingAddressOnCart( diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md index 0966bf607f8..c2d4b645f1a 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-coupon.md @@ -22,6 +22,9 @@ Use [applyCouponToCart]({{ page.baseurl }}/graphql/reference/quote-apply-coupon. **Request** +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + ```text mutation { applyCouponToCart( @@ -59,6 +62,9 @@ Use [removeCouponFromCart]({{ page.baseurl }}/graphql/reference/quote-remove-cou **Request** +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + ```text mutation { removeCouponFromCart(input: { cart_id: "{ CART_ID }" }) { diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md index 7862c243094..e67aa0e02d4 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-payment-method.md @@ -14,12 +14,18 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- +{:.bs-callout .bs-callout-tip} +You must always set a payment method. + Use the following `cart` query to determine which payment methods which are available for your order. `{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). **Request** +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + ```text query { cart(cart_id: "{ CART_ID }") { @@ -50,11 +56,11 @@ query { Use the `setPaymentMethodOnCart` mutation to set the payment method for your order. The value `checkmo` ("Check / Money order" payment method code) was returned in the query. +**Request** + {:.bs-callout .bs-callout-info} For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. -**Request** - ```text mutation { setPaymentMethodOnCart(input: { diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md index 54e98ea39f8..28363ca8088 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-place-order.md @@ -18,11 +18,11 @@ The `placeOrder` mutation places an order. `{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +**Request** + {:.bs-callout .bs-callout-info} For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. -**Request** - ```text mutation { placeOrder(input: {cart_id: "{ CART_ID }"}) { diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md index 19e61090c97..a463b19edc1 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-address.md @@ -22,12 +22,12 @@ Use the [setShippingAddressesOnCart]({{ page.baseurl }}/graphql/reference/quote- ## Create a new shipping address -**Request** - The following mutation adds a shipping address to the quote. `{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +**Request** + {:.bs-callout .bs-callout-info} For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index 1d7acac8643..2ac75007bc6 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -26,6 +26,9 @@ The `setShippingMethodsOnCart` mutation defines the shipping methods for your or The following mutation query assigns UPS "Ground" method. +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + ```text mutation { setShippingMethodsOnCart(input: { @@ -72,9 +75,6 @@ mutation { } ``` -{:.bs-callout .bs-callout-info} -For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. - ## Verify this step {#verify-step} 1. Sign in as a customer to the website using the email `john.doe@example.com` and password `b1b2b3l@w+`. From f61227d4e53d8fe5eb9b43c57cc8d3f0f03c213d Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Mon, 24 Jun 2019 19:12:30 +0300 Subject: [PATCH 37/40] magento/devdocs#: GraphQl checkout tutorial. --- .../graphql/tutorials/checkout/checkout-shipping-method.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md index 2ac75007bc6..7ec6fd96bb7 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-shipping-method.md @@ -22,13 +22,13 @@ The `setShippingMethodsOnCart` mutation defines the shipping methods for your or `{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). +{:.bs-callout .bs-callout-info} +For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. + **Request** The following mutation query assigns UPS "Ground" method. -{:.bs-callout .bs-callout-info} -For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. - ```text mutation { setShippingMethodsOnCart(input: { From ce51831db0c10ca453e4a2623a4cfff76727456b Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Tue, 25 Jun 2019 10:58:51 -0500 Subject: [PATCH 38/40] Update index.md --- guides/v2.3/graphql/tutorials/checkout/index.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/index.md b/guides/v2.3/graphql/tutorials/checkout/index.md index d866fa1d366..c340a13ef4f 100644 --- a/guides/v2.3/graphql/tutorials/checkout/index.md +++ b/guides/v2.3/graphql/tutorials/checkout/index.md @@ -23,23 +23,12 @@ The **10-step tutorial** generally takes **30 minutes**. The checkout process in GraphQl consists of 10 steps. Magento GraphQL is designed to run queries and perform actions on behalf of a customer. Magento GraphQL does not perform backend tasks, such as manage invoices or shipments. -[Create a customer]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-customer.html) (create customer, use a registered customer account or place order as guest) -[Create an empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shopping-cart.html) -[Add product to cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html) -[Set the shipping address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-address.html) -[Set billing address]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-billing-address.html) -[Set the shipping method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-shipping-method.html) -[Set the payment method]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-payment-method.html) -[Apply a coupon]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-coupon.html) -[Set email on the cart (guest customers only)]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-quote-email.html) -[Place order]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-place-order.html) - ### Before you begin {:.tutorial-before} Complete the following prerequisites: -* Install a Magento 2.3 (or later) instance with sample data. +* Install a Magento 2.3.2 instance with sample data. The sample data defines a functional store, called Luma, that sells fitness clothing and accessories. The store does not provide any sandbox accounts for testing credit card payments, so transactions will be simulated using an offline {% glossarytooltip 422b0fa8-b181-4c7c-93a2-c553abb34efd %}payment method{% endglossarytooltip %}. From 5471840c5e275ad6267579e85e6467f71da12463 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Tue, 25 Jun 2019 11:04:17 -0500 Subject: [PATCH 39/40] Update checkout-add-product-to-cart.md Removing a couple of notes since a similar note is now in the top section. Added a couple of minor edits. --- .../checkout/checkout-add-product-to-cart.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md index 5570647b17e..446e35618af 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-add-product-to-cart.md @@ -1,7 +1,7 @@ --- layout: tutorial group: graphql -title: Step 3. Add product to cart +title: Step 3. Add products to the cart subtitle: GraphQL checkout tutorial level3_subgroup: graphql-checkout return_to: @@ -24,15 +24,12 @@ If you add a product to the shopping cart as a registered customer, be sure to s `{ CART_ID }` is the unique shopping cart ID from [Step 2. Create empty cart]({{ page.baseurl }}/graphql/tutorials/checkout/checkout-add-product-to-cart.html). -## Add a simple product into shopping cart +## Add a simple product into the shopping cart The following mutation adds a **simple product** into shopping cart. **Request** -{:.bs-callout .bs-callout-info} -For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. - ```text mutation { addSimpleProductsToCart( @@ -85,15 +82,12 @@ mutation { } ``` -## Add a virtual product into shopping cart +## Add a virtual product into the shopping cart The following mutation adds a **virtual product** into shopping cart. **Request** -{:.bs-callout .bs-callout-info} -For logged-in customers, send the customer's authorization token in the `Authorization` parameter of the header. See ["Get customer authorization token"]({{ page.baseurl }}/graphql/get-customer-authorization-token.html) for more information. - ```text mutation { addVirtualProductsToCart( From 2d4e91141c071d4c5d0b73c8aaee3828ebbf1d58 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Tue, 25 Jun 2019 13:19:40 -0500 Subject: [PATCH 40/40] Update checkout-billing-address.md Fix outdated link --- .../v2.3/graphql/tutorials/checkout/checkout-billing-address.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md index 1bca9c803c2..99175ca4a3e 100644 --- a/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md +++ b/guides/v2.3/graphql/tutorials/checkout/checkout-billing-address.md @@ -17,7 +17,7 @@ contributor_link: https://www.atwix.com/ {:.bs-callout .bs-callout-tip} You must always set the billing address to place an order. -Use the [setBillingAddressOnCart]({{ page.baseurl }}/graphql/reference/quote.html#set-the-billing-address-on-cart-attributes) mutation to set a billing address. You can set the billing address in the following ways: +Use the [setBillingAddressOnCart]({{ page.baseurl }}/graphql/reference/quote-set-billing-address.html) mutation to set a billing address. You can set the billing address in the following ways: * Add a new billing address * Add a new billing address and set it as the shipping addresses