Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Reworked GraphQL tutorial #8046

Merged
merged 30 commits into from
Nov 23, 2020
Merged

Reworked GraphQL tutorial #8046

merged 30 commits into from
Nov 23, 2020

Conversation

dobooth
Copy link
Contributor

@dobooth dobooth commented Oct 14, 2020

Purpose of this pull request

This pull request (PR) enhances and fixes the GraphQL tutorial.
It clarifies steps, adds instructions for creating a coupon and other markup fixes.

Affected DevDocs pages

whatsnew
Simplified and updated the GraphQL tutorial.


The **10-step tutorial** generally takes **30 minutes**.
The 10-step tutorial generally takes 30 minutes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert. The highlighting is part of the tutorial template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


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 [payment method](https://glossary.magento.com/payment-method).

* Install a GraphQl client. You can use any GraphQl client to send calls to Magento. [GraphiQL](https://electronjs.org/apps/graphiql) is recommended.
- In the Magento admin, create a coupon that will be used in [Step 7. Apply a coupon]({{page.baseurl}}/graphql/tutorials/checkout/checkout-coupon.html).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a link to merchdocs. Also, this isn't the most important bullet item. Delete the "Find the merchant documentation" item and replace it with this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -220,17 +205,18 @@ mutation {
]
}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add these back. They're the closing marks for the data and top-level` objects. Also I think the lack of blank line afterward is causing the display problems in GH.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


## Verify this step {#verify-step}

Sign in as a customer to the website using the email `[email protected]` and password `b1b2b3l@w+`. You should be successfully logged in.

[Authorization tokens]({{page.baseurl}}/graphql/authorization-tokens.html) describes the mutation further.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this line to be above "Verify this step"

@@ -22,57 +22,42 @@ Use the [setShippingAddressesOnCart]({{ page.baseurl }}/graphql/mutations/set-sh

## Create a new shipping address

The following mutation adds a shipping address to the quote.
In this step, we use the `createCustomerAddress` mutation to add a shipping address to the customer record. Then we can use it in the cart.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the bulleted list at the beginning of the topic, change "Add" to "Create". Also, delete the second bullet. Maybe wordsmith the intro a bit to say the tutorial shows two ways to set a shipping address.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've broken the tutorial. We don't describe how to set the shipping address for a guest.


For **Rule Information**:

- Rule Name: Watch Coupon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make all the field names bold.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


```text
```graphql
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the last line of the topic, the right parenthesis is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

mutation {
setShippingAddressesOnCart(
input: {
cart_id: "{ CART_ID }"
cart_id: "{{ CART_ID }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove a set of braces. With a double set, Jekyll thinks CART_ID is a varaible, which renders as a blank.

Also, insert a region_id and set save_in_address_book to true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's from trying to get variables working in Altair.

@@ -25,53 +25,42 @@ Use the [setBillingAddressOnCart]({{ page.baseurl }}/graphql/mutations/set-billi

## 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).
Similar to the previous step, we will add a billing address to the customer. `{ 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). In this example, the `default_billing` parameter is set to `true`. The street address is also different, so we can see that different addresses are being created.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of everything but adding a billing address to the cart, so the procedure is the same for guests and customers.

The shipping and billing addresses are now different. That's OK, but be sure to mention that.

@dobooth dobooth closed this Nov 23, 2020
@ghost
Copy link

ghost commented Nov 23, 2020

Hi @dobooth, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@dobooth dobooth closed this Nov 23, 2020
@ghost
Copy link

ghost commented Nov 23, 2020

Hi @dobooth, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Copy link
Contributor

@keharper keharper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of nits, but the setShippingAddressOnCart response needs to be expanded.

@@ -88,6 +88,11 @@ mutation {
}
```

## Add Authorization header
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Add Authorization header
## Specify an Authorization header


`{ 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).
If using a logged in customer, send the customer's authorization token in the `Authorization` parameter of the header. See [Authorization tokens]({{page.baseurl}}/graphql/authorization-tokens.html) for more information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The response needs to include the available_shipping_methods object. Add it after the country object

  available_shipping_methods{
    carrier_code
    carrier_title
    method_code
    method_title
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -22,21 +22,22 @@ The `setShippingMethodsOnCart` mutation defines the delivery 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}
The `carrier_code` and `method_code` values come from the results of the mutation on the previous step.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's currently missing from the tutorial. This should link to the shipping address step

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

carrier_code: "ups"
method_code: "GND"
carrier_code: "tablerate"
method_code: "bestway"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alignment is off here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

@dobooth dobooth added 2.3.x Magento 2.3 related changes 2.4.x Magento 2.4.x related changes Major Update Significant original updates to existing content labels Nov 23, 2020
@keharper
Copy link
Contributor

running tests

@keharper keharper merged commit 807f1b2 into master Nov 23, 2020
@ghost
Copy link

ghost commented Nov 23, 2020

Hi @dobooth, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@keharper keharper deleted the db_graphql_tutorial branch December 1, 2020 22:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2.3.x Magento 2.3 related changes 2.4.x Magento 2.4.x related changes hacktoberfest-accepted Major Update Significant original updates to existing content Progress: done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants