Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ShippingMethod type and associate to ShippingRate #187

Merged
merged 1 commit into from Sep 16, 2021

Conversation

waiting-for-dev
Copy link
Contributor

It allows querying the shipping rates information for orders along
with the shipping method information, which is something that usually
needs to be displayed to the end-user.

Example:

query shippingInformation {
  currentOrder {
    shipments {
      nodes {
        shippingRates {
          nodes {
            cost
            currency
            shippingMethod {
              name
              trackingUrl
              carrier
            }
          }
        }
      }
    }
  }
}

Response:

{
  "data": {
    "currentOrder": {
      "shipments": {
        "nodes": [
          {
            "shippingRates": {
              "nodes": [
                {
                  "cost": "5.0",
                  "currency": "USD",
                  "shippingMethod": {
                    "name": "UPS Ground (USD)",
                    "trackingUrl": null,
                    "carrier": null
                  }
                },
                {
                  "cost": "10.0",
                  "currency": "USD",
                  "shippingMethod": {
                    "name": "UPS Two Day (USD)",
                    "trackingUrl": null,
                    "carrier": null
                  }
                },
                {
                  "cost": "15.0",
                  "currency": "USD",
                  "shippingMethod": {
                    "name": "UPS One Day (USD)",
                    "trackingUrl": null,
                    "carrier": null
                  }
                }
              ]
            }
          }
        ]
      }
    }

Fixes #179

It allows querying the shipping rates information for orders along
with the shipping method information, which is something that usually
needs to be displayed to the end-user.

Example:

```graphql
query shippingInformation {
  currentOrder {
    shipments {
      nodes {
        shippingRates {
          nodes {
            cost
            currency
            shippingMethod {
              name
              trackingUrl
              carrier
            }
          }
        }
      }
    }
  }
}
```

Response:

```json
{
  "data": {
    "currentOrder": {
      "shipments": {
        "nodes": [
          {
            "shippingRates": {
              "nodes": [
                {
                  "cost": "5.0",
                  "currency": "USD",
                  "shippingMethod": {
                    "name": "UPS Ground (USD)",
                    "trackingUrl": null,
                    "carrier": null
                  }
                },
                {
                  "cost": "10.0",
                  "currency": "USD",
                  "shippingMethod": {
                    "name": "UPS Two Day (USD)",
                    "trackingUrl": null,
                    "carrier": null
                  }
                },
                {
                  "cost": "15.0",
                  "currency": "USD",
                  "shippingMethod": {
                    "name": "UPS One Day (USD)",
                    "trackingUrl": null,
                    "carrier": null
                  }
                }
              ]
            }
          }
        ]
      }
    }
```

Fixes #179
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks Marc

@kennyadsl kennyadsl merged commit 11d25f7 into master Sep 16, 2021
@waiting-for-dev waiting-for-dev deleted the waiting-for-dev/shipping_method_to_shipping_rate branch September 16, 2021 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add shipping_method field to ShippingRate
2 participants