
# Shipping Costs


[Link to swagger documentation](https://app-seller-inventory.sandbox.infra.metro-markets.cloud/openapi/v1/api-doc)

1. [What are Shipping Groups?](#1-what-are-shipping-groups)
2. [How to configure Shipping Groups?](#2-how-to-configure-shipping-groups)
3. [How to associate a Shipping Group to an offer?](#3-how-to-associate-a-shipping-group-to-an-offer)
   
   - [Change the associated Shipping Group to the offer](#change-the-associated-shipping-group-to-the-offer)
   - [Check the association between Offer and Shipping Group](#check-the-association-between-offer-and-shipping-group)

### 1. What are Shipping Groups?

A Shipping Group is a combination of shipping costs, free delivery threshold and destinations.

You can indicate the shipping costs using the shipping groups.  
You can configure multiple shipping groups. One offer can have only a single Shipping Group.

### 2. How to create Shipping Groups?

You can create Shiping Groups in [Seller Office](https://web-app-seller.sandbox.infra.metro-markets.cloud/en/workplace/shipping-groups/) in Shop Settings / Shiping Groups / Create New Shipping Groups.

| Parameter                   | Requirement | Description                                                                                                                                                                                                                        |
|-----------------------------|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Shipping Group Name         | mandatory   | Name of the Shipping Group.                                                                                                                                                                                                        |
| Destinations                | mandatory   | The area where the shipping group is applied and goods are delivered to. Once crossboders are activated, a shipping Group can have different destinations.                                                                         |
| Net Shipping Fee            | mandatory   | Net price of the shipping costs (or costs of the goods delivery). Given in EUR and per one article. It can be 0.00 EUR, which means free shipping. 500.00 EUR is a business limit on the max value.                                |
| per extra item              | optional    | Additional costs that Seller can charge for each next item in the order within a particular Shipping Group. Always in EUR and for each product in the basket. It can be 0.00 EUR. 500.00 EUR is a business limit on the max value. |
| Net Free shipping threshold | optional    | To indicate a free-shipping threshold. By reaching exactly this threshold Marketplace will indicate to the Buyer that shipping for goods within a particular shipping group will be free of charge.                                |

**Example**  
`Shipping Group Name` Parcels having `ShippingCosts` of 4.80 EUR Netto, without `per extra item` and setting a `Threshold` value of 139.00 EUR.  
Outcome: If customers buy articles from the assortment within the “Parcels” shipping group, an amount of 4.80 EUR shipping costs will be charged. If the total sum of items in the order within a “Parcels” shipping group exceeds 139.00 EUR, then shipping is free.

![](/images/uploads/shippinggroups.png)

Once the Shipping Group is created, you need to copy the Name. This Name is the `shippingGroupName` that you need to send in the Offer request ([see point #3](#3-how-to-associate-a-shipping-group-to-an-offer))

![](/images/uploads/shippinggroupName.png)

### 3. How to associate a Shipping Group to an offer?

Once the Shipping Groups are created, you need to assign them to the Offers.

Using the already known offer endpoint `POST /openapi/v2/offers` you can just add the `shippingGroupName` in the body.  
The `shippingGroupName` is optional and it needs to be previously created. It can also be null.  
Shipping Group destination must match with the destination from the Offer. Otherwise request will result into bad request http status code 400.

`shippingGroupId` is also accepted, but it will be deprecated. So please use `shippingGroupName` instead  
Please provide `shippingGroupName` OR `shippingGroupId`, if both are provided, `http 400 Bad request` will be returned.

Request

```
{
  "gtin": "4251143960263",
  "sku": "",
  "mpn": "",
  "manufacturer": null,
  "quantity": 20,
  "netPrice": {
    "amount": 50,
    "currency": "EUR"
  },
  "processingTime": 5,
  "maxProcessingTime": 10,
  "businessModel": "B2B",
  "freightForwarding": true,
  "netVolumePrices": [
    {
      "price": {
        "amount": 48,
        "currency": "EUR"
      },
      "quantity": 2
    }
  ],
  "destination": "DE_MAIN",
  "origin": "DE_MAIN",
  "shippingGroupName": "2ManHandling"
}
```

Response `http status code 201` -> created

```
{
    "offerNumber": "1234",
    "gtin": "4251143960263",
    "mid": "AAA0000057385",
    "sku": "8858488",
    "mpn": "1",
    "manufacturer": "Random company",
    "netPrice": {
        "amount": "50.00",
        "currency": "EUR"
    },
    "processingTime": 5,
    "maxProcessingTime": 10,
    "businessModel": 2,
    "quantity": 20,
    "freightForwarding": true,
    "offerStatus": {
        "internalStatus": "active",
        "readableStatus": "Aktiv"
    },
    "productStatus": {
        "internalStatus": 1,
        "readableStatus": "published"
    },
    "netVolumePrices": [
        {
            "price": {
                "amount": "48.00",
                "currency": "EUR"
            },
            "quantity": 2
        }
    ],
    "isActive": true,
    "productKey": "ded54740-9d64-46fc-920d-0a982aa3391b",
    "productName": "Motivknöpfe Karpfen Fb. Kupfer",
    "services": [],
    "destination": "DE_MAIN",
    "origin": "DE_MAIN",
    "shippingGroup": {
        "shippingGroupId": "23855521-1902-4a90-acb7-81a4744c1759",
        "shippingGroupName": "2ManHandling",
        "createdAt": "2022-03-27T22:00:35+00:00"
    }
}
```

Response `http status code 400` -> Bad request

Response `http status code 401` -> Unauthorized

Response `http status code 404` -> if Shipping Group doesn´t exist

#### Change the associated Shipping Group to the offer

In case you would like to associate a different Shipping Group to an offer, you just need to submit a new `POST /openapi/v2/offers` request with the new `shippingGroupName`.

In case you would like to remove the associated Shipping Group to an offer, you can submit a new `POST /openapi/v2/offers` request without `shippingGroupName` or with `shippingGroupName: null`.

#### Check the association between Offer and Shipping Group

By submitting a request to `GET v2/offers`. In the response you will find the offer data and the shippingGroup section containing the shipping group details.
