> For the complete documentation index, see [llms.txt](https://docs.datajet-app.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datajet-app.com/scripts/blank/shipping-rate.md).

# Shipping Rate

{% hint style="info" %}
Shipping Rate task is available only on Advanced Shopify plan or higher.
{% endhint %}

With this task you can create your custom shipping rates returned on checkout shipping step. Task allows creating complex logic to calculate shipping rate based on:

* cart items
* shipping address
* customer (Shopify Script Editor required)

Incoming request has following format:

```
  {
    "rate": {
      "origin": {
        "country": "CA",
        "postal_code": "K2P1L4",
        "province": "ON",
        "city": "Ottawa",
        "name": null,
        "address1": "150 Elgin St.",
        "address2": "",
        "address3": null,
        "phone": "16135551212",
        "fax": null,
        "email": null,
        "address_type": null,
        "company_name": "Jamie D's Emporium"
      },
      "destination": {
        "country": "CA",
        "postal_code": "K1M1M4",
        "province": "ON",
        "city": "Ottawa",
        "name": "Bob Norman",
        "address1": "24 Sussex Dr.",
        "address2": "",
        "address3": null,
        "phone": null,
        "fax": null,
        "email": null,
        "address_type": null,
        "company_name": null
      },
      "items": [
        {
          "name": "Short Sleeve T-Shirt",
          "sku": "",
          "quantity": 1,
          "grams": 1000,
          "price": 1999,
          "vendor": "Jamie D's Emporium",
          "requires_shipping": true,
          "taxable": true,
          "fulfillment_service": "manual",
          "properties": null,
          "product_id": 48447225880,
          "variant_id": 258644705304
        }
      ],
      "currency": "USD",
      "locale": "en"
    }
  }
```

You can access this payload through `request` object:

```
{{request.body.rate | log }}
```

Above line outputs payload to logs.

You can now parse available information to calculate additional shipping rates returned on checkout shipping step.

Example response would look like this:

```
{% json response %}
  {
    "body": {
      "rates": [
        {
          "service_name": "canadapost-overnight",
          "service_code": "ON",
          "total_price": "1295",
          "description": "This is the fastest option by far",
          "currency": "CAD",
          "min_delivery_date": "2013-04-12 14:48:45 -0400",
          "max_delivery_date": "2013-04-12 14:48:45 -0400"
        }
      ]
    }
  }
{% endjson %}
```

On checkout you should see:<br>

<figure><img src="/files/lVgk6IEVFSTmDOl6u8w5" alt=""><figcaption></figcaption></figure>
