> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Multiple delivery addresses and sample copies

> The BASKET tags for split orders: splitting a basket item across multiple delivery addresses, ordering sample copies, and evaluating the input validation.

With a split order, the buyer splits a single basket item across multiple delivery addresses: 100 catalogs, 40 of them to one branch and 60 to another. A special case of this is the sample copy, that is, a small quantity that is sent additionally to a separate address.

The tags on this page are numerous but follow a clear structure:

| Prefix | Refers to |
| - | - |
| `BASKET-PR-MultiDeliveryAddress_…` | what is generally possible for this product |
| `BASKET-PR-D-…` | what the buyer has actually set |
| `BASKET-PR-D-MultiData…` | the individual split address within the item |
| `BASKET-Total…` | the totals across the entire basket |

Guide: Requesting billing and multiple delivery addresses

## The structure in the template

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{@BASKET-PR-Data}
   ~BASKET-PR-Name~

   {BASKET-PR-MultiDeliveryAddress_available}

      {BASKET-PR-D-SingleData}
         Eine abweichende Lieferadresse ist gewählt.
         {BASKET-PR-D-SingleData_ButtonValue_edit}
            <button name="~BASKET-PR-D-ButtonName~" type="submit"
                    value="~BASKET-PR-D-SingleData_ButtonValue_edit~">Adresse ändern</button>
         {/BASKET-PR-D-SingleData_ButtonValue_edit}
      {/BASKET-PR-D-SingleData}

      {BASKET-PR-D-MultiData}
         ~BASKET-PR-D-MultiData~ Adressen werden beliefert.

         {@BASKET-PR-D-MultiData}
            {BASKET-PR-D-MultiData_SampleCopy}Belegexemplar:{/BASKET-PR-D-MultiData_SampleCopy}
            ~BASKET-PR-D-MultiData_quantity~ Stück an ~D-FirstName~ ~D-LastName~

            {BASKET-PR-D-MultiData_quantityError}
               Die Menge muss größer als null sein.
            {/BASKET-PR-D-MultiData_quantityError}
         {/@BASKET-PR-D-MultiData}

      {/BASKET-PR-D-MultiData}

      {BASKET-PR-D-MultiDataAvailable}
         <button name="~BASKET-PR-D-ButtonName~" type="submit"
                 value="~BASKET-PR-D-ButtonValue_new~">Weitere Lieferadresse</button>
      {/BASKET-PR-D-MultiDataAvailable}

   {/BASKET-PR-MultiDeliveryAddress_available}
{/@BASKET-PR-Data}
```

> [!NOTE]
>
> The outer check with `BASKET-PR-MultiDeliveryAddress_available` is worthwhile because most products in a shop cannot be split at all. Without it, every ordinary item has a range that never displays anything.

## What is possible

These tags answer what is intended for the product, regardless of what the buyer has set.

| Tag | Single tag | Range tag | Negative range tag | Purpose |
| - | - | - | - | - |
| `BASKET-PR-D_available` | – | yes | yes | split order is enabled for the subshop |
| `BASKET-PR-MultiDeliveryAddress_available` | – | yes | yes | multiple addresses are possible for this item |
| `BASKET-PR-MultiDeliveryAddress_mda_available` | – | yes | yes | split order is possible for this product |
| `BASKET-PR-MultiDeliveryAddress_mda_minorderqty` | yes | yes | yes | minimum quantity for split order |
| `BASKET-PR-MultiDeliveryAddress_mda_maxaddresses` | yes | – | – | maximum number of regular addresses |
| `BASKET-PR-MultiDeliveryAddress_mda_denomination` | yes | yes | yes | denomination size |
| `BASKET-PR-MultiDeliveryAddress_sc_available` | – | yes | yes | sample copy is possible |
| `BASKET-PR-MultiDeliveryAddress_sc_minorderqty` | yes | yes | yes | minimum quantity for a sample copy |
| `BASKET-PR-MultiDeliveryAddress_sc_quantity` | yes | yes | yes | number of sample copies ordered |
| `BASKET-PR-MultiDeliveryAddress_sc_price` | yes | yes | yes | surcharge per sample copy |

> [!NOTE]
>
> The abbreviation `mda` stands for the regular split addresses, `sc` for SampleCopy, that is, the sample copy. The two are configured separately and checked separately.

> [!WARNING]
>
> `BASKET-PR-D_available` checks the subshop, `BASKET-PR-MultiDeliveryAddress_mda_available` the individual product. Both must be true; otherwise, the function remains off even though the product seems to allow it.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{BASKET-PR-MultiDeliveryAddress_mda_available}
   Dieses Produkt kann auf bis zu ~BASKET-PR-MultiDeliveryAddress_mda_maxaddresses~ Adressen
   aufgeteilt werden

   {BASKET-PR-MultiDeliveryAddress_mda_minorderqty}
      , ab einer Menge von ~BASKET-PR-MultiDeliveryAddress_mda_minorderqty~ Stück
   {/BASKET-PR-MultiDeliveryAddress_mda_minorderqty}

   {BASKET-PR-MultiDeliveryAddress_mda_denomination}
      , jeweils in Schritten von ~BASKET-PR-MultiDeliveryAddress_mda_denomination~ Stück
   {/BASKET-PR-MultiDeliveryAddress_mda_denomination}
   .
{/BASKET-PR-MultiDeliveryAddress_mda_available}
```

> [!NOTE]
>
> State the minimum quantity and denomination before the buyer enters anything. An error message after submitting is a surprise for them; a step of 25 pieces mentioned beforehand is not.

## What has been set

| Tag | Single tag | Range tag | Negative range tag | Loop tag |
| - | - | - | - | - |
| `BASKET-PR-D` | – | yes | yes | – |
| `BASKET-PR-D-SingleData` | – | yes | yes | – |
| `BASKET-PR-D-MultiData` | yes | yes | yes | yes |
| `BASKET-PR-D-MultiDataAvailable` | – | yes | yes | – |
| `BASKET-PR-D-MultiDataQuantityleft` | yes | yes | yes | – |
| `BASKET-PR-D-SampleCopyAvailable` | – | yes | yes | – |
| `BASKET-PR-D-SampleCopySelected` | – | yes | yes | – |
| `BASKET-PR-MDMaffected` | – | yes | yes | – |
| `BASKET-PR-D-MDMaffected` | – | yes | yes | – |

### BASKET-PR-D

The range is displayed if the option "Deliver to multiple addresses" has been selected and at least one different delivery address exists.

### BASKET-PR-D-SingleData and BASKET-PR-D-MultiData

`BASKET-PR-D-SingleData` applies if exactly one different delivery address has been selected. `BASKET-PR-D-MultiData` applies from two addresses and is also the loop over them. As a single tag, it outputs the number of addresses used, including the sample copy.

> [!NOTE]
>
> The two are mutually exclusive. An item has either one different address or several, and the template sections for them look different: one is a single line, the other a table.

### BASKET-PR-D-MultiDataAvailable and BASKET-PR-D-MultiDataQuantityleft

`BASKET-PR-D-MultiDataAvailable` applies if another address may still be created. Minimum quantity and remaining quantity are already taken into account. `BASKET-PR-D-MultiDataQuantityleft` outputs the quantity not yet distributed.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{BASKET-PR-D-MultiDataQuantityleft}
   Noch zu verteilen: ~BASKET-PR-D-MultiDataQuantityleft~ Stück
{/BASKET-PR-D-MultiDataQuantityleft}

{!BASKET-PR-D-MultiDataQuantityleft}
   Die gesamte Menge ist verteilt.
{/!BASKET-PR-D-MultiDataQuantityleft}
```

> [!NOTE]
>
> The remaining quantity is the most important feedback on this page. Without it, the buyer only notices when submitting that there are pieces left over and has to recalculate the distribution from scratch.

### BASKET-PR-MDMaffected and BASKET-PR-D-MDMaffected

Both indicate that a delivery address has been changed. `BASKET-PR-MDMaffected` refers to the item, `BASKET-PR-D-MDMaffected` to the individual split address within the item.

## The individual split address

These tags belong in the loop `{@BASKET-PR-D-MultiData}` and each describes one address.

| Tag | Single tag | Range tag | Negative range tag | Purpose |
| - | - | - | - | - |
| `BASKET-PR-D-MultiData_quantity` | yes | – | – | quantity for this address |
| `BASKET-PR-D-MultiData_quantity_input` | yes | yes | yes | name of the quantity input field |
| `BASKET-PR-D-MultiData_technicalquantity()` | yes | – | – | quantity in a freely selectable notation |
| `BASKET-PR-D-MultiData_SampleCopy` | – | yes | yes | this address is the sample copy |
| `BASKET-PR-D-MultiData_quantityError` | – | yes | yes | quantity is zero or negative |
| `BASKET-PR-D-MultiData_denominationError` | – | yes | yes | denomination not observed |
| `BASKET-PR-D-MultiData_ValueOfGoodsDependentDeliveryCostAmount` | yes | yes | yes | shipping cost share, dependent on goods value |
| `BASKET-PR-D-MultiData_WeightDependentDeliveryCostAmount` | yes | yes | yes | shipping cost share, dependent on weight |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{@BASKET-PR-D-MultiData}

   {BASKET-PR-D-MultiData_quantity_input}
      <input type="text"
             name="~BASKET-PR-D-MultiData_quantity_input~"
             value="~BASKET-PR-D-MultiData_quantity~">
   {/BASKET-PR-D-MultiData_quantity_input}

   {!BASKET-PR-D-MultiData_quantity_input}
      ~BASKET-PR-D-MultiData_quantity~ Stück
   {/!BASKET-PR-D-MultiData_quantity_input}

   an ~D-FirstName~ ~D-LastName~, ~D-City~

{/@BASKET-PR-D-MultiData}
```

> [!NOTE]
>
> `BASKET-PR-D-MultiData_quantity_input` as a range tag answers whether the quantity can be changed at all. For the sample copy, this is often not the case, so a fixed number belongs there instead of an input field.

> [!NOTE]
>
> The two shipping cost tags do two things: as a range tag, they indicate what the share depends on; as a single tag, they output the amount. For a split item that goes to two countries, this makes it clear why the shares differ.

## Sample copies

| Tag | Purpose |
| - | - |
| `BASKET-PR-D-SampleCopyAvailable` | a sample copy can still be selected |
| `BASKET-PR-D-SampleCopySelected` | a sample copy is selected and active |
| `BASKET-PR-SampleCopyCost` | cost of the sample copy of this item |
| `BASKET-TotalSampleCopyCost` | cost of all sample copies of the order |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{BASKET-PR-D-SampleCopyAvailable}
   <button name="~BASKET-PR-D-ButtonName~" type="submit"
           value="~BASKET-PR-D-ButtonValue_SampleCopy_new~">Belegexemplar bestellen</button>
{/BASKET-PR-D-SampleCopyAvailable}

{BASKET-PR-D-SampleCopySelected}
   Belegexemplar ist bestellt.

   {BASKET-PR-SampleCopyCost}
      Kosten: ~BASKET-PR-SampleCopyCost~ ~WS-CurrencySymbol~
   {/BASKET-PR-SampleCopyCost}

   {BASKET-PR-D-ButtonValue_SampleCopy_edit}
      <button name="~BASKET-PR-D-ButtonName~" type="submit"
              value="~BASKET-PR-D-ButtonValue_SampleCopy_edit~">Ändern</button>
   {/BASKET-PR-D-ButtonValue_SampleCopy_edit}

   <button name="~BASKET-PR-D-ButtonName~" type="submit"
           value="~BASKET-PR-D-ButtonValue_SampleCopy_delete~">Löschen</button>
{/BASKET-PR-D-SampleCopySelected}
```

## The buttons

All actions run via the same button with a changing value. The name comes from `BASKET-PR-D-ButtonName`; the value determines what happens.

| Tag | Action |
| - | - |
| `BASKET-PR-D-ButtonValue_new` | select another delivery address |
| `BASKET-PR-D-ButtonValue_reload` | reload inputs |
| `BASKET-PR-D-SingleData_ButtonValue_edit` | change the single address |
| `BASKET-PR-D-SingleData_ButtonValue_delete` | delete the single address |
| `BASKET-PR-D-MultiData_ButtonValue_edit` | change an address from the list |
| `BASKET-PR-D-MultiData_ButtonValue_delete` | delete an address from the list |
| `BASKET-PR-D-ButtonValue_SampleCopy_new` | order a sample copy |
| `BASKET-PR-D-ButtonValue_SampleCopy_edit` | change the sample copy |
| `BASKET-PR-D-ButtonValue_SampleCopy_delete` | delete the sample copy |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<button name="~BASKET-PR-D-ButtonName~" type="submit" value="~BASKET-PR-D-ButtonValue_new~">
   Weitere Lieferadresse
</button>
```

> [!NOTE]
>
> The three values for changing are also range tags. They only apply if the change is allowed in the current state. Bracket the button with them instead of outputting it unchecked.

## The validation

| Tag | Single tag | Range tag | Negative range tag | Purpose |
| - | - | - | - | - |
| `BASKET-DeliverySplit_OK` | – | yes | yes | validation of all items |
| `BASKET-PR-MultiDeliveryAddress_ErrorCode()` | yes | yes | yes | validation of one item |

`BASKET-DeliverySplit_OK` triggers the validation of all basket items and applies if there is nothing to object to. `BASKET-PR-MultiDeliveryAddress_ErrorCode()` checks a single item and outputs the error code.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{!BASKET-DeliverySplit_OK}
   Bitte prüfen Sie Ihre Angaben zu den Lieferadressen.
{/!BASKET-DeliverySplit_OK}

{@BASKET-PR-Data}
   {BASKET-PR-MultiDeliveryAddress_ErrorCode(10)}
      Es ist noch eine Restmenge übrig, die keiner Adresse zugeordnet ist.
   {/BASKET-PR-MultiDeliveryAddress_ErrorCode(10)}

   {BASKET-PR-MultiDeliveryAddress_ErrorCode(11)}
      Die Mengen halten die vorgegebene Stückelung nicht ein.
   {/BASKET-PR-MultiDeliveryAddress_ErrorCode(11)}
{/@BASKET-PR-Data}
```

### The error codes

| Code | Cause |
| - | - |
| 0 | no error or not checked |
| 1 | address not found |
| 2 | sample copy selected, but generally not available |
| 3 | sample copy selected, but minimum quantity not reached |
| 4 | address not found |
| 5 | number of delivery addresses does not match the number of items |
| 6 | split order is not allowed |
| 7 | split order not allowed, quantity dependency not met |
| 8 | maximum number of addresses exceeded |
| 9 | order quantity exceeded |
| 10 | remaining quantity left over |
| 11 | graduation error |
| 12 | quantity is zero |
| 13 | distribution product: different delivery address not permitted |

> [!WARNING]
>
> Codes 1 and 4 are internal errors and not input errors by the buyer. Do not display correction instructions for them; show a general notice instead, and contact your WEBSALE contact.

> [!NOTE]
>
> Without a parameter, the tag outputs the code and applies as a range as soon as any error exists. With a parameter, it only applies for exactly that code. For understandable messages, the variant with a parameter is the right one, because only it can say what needs to be done.

## Additional costs due to split order

| Tag | Purpose |
| - | - |
| `BASKET-PR-MultiDeliveryAddressUsageCost` | surcharge for this item |
| `BASKET-TotalMultiDeliveryAddressUsageCost` | surcharge for the entire basket |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{BASKET-TotalMultiDeliveryAddressUsageCost}
   Aufpreis für die Lieferung an mehrere Adressen:
   ~BASKET-TotalMultiDeliveryAddressUsageCost~ ~WS-CurrencySymbol~
{/BASKET-TotalMultiDeliveryAddressUsageCost}
```

## Partial delivery

### BASKET-PR-SplitDelivery

The range is displayed if only part of the item can be delivered and the availability is therefore output split up. The tag is only permitted within `BASKET-PR-Inventory`.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{BASKET-PR-Inventory}
   {BASKET-PR-SplitDelivery}
      Eine Teillieferung ist notwendig.
   {/BASKET-PR-SplitDelivery}

   {!BASKET-PR-SplitDelivery}
      Die gewünschte Menge kann vollständig geliefert werden.
   {/!BASKET-PR-SplitDelivery}
{/BASKET-PR-Inventory}
```

> [!WARNING]
>
> This tag has nothing to do with split orders, even though the name sounds similar. It is about stock availability, not about multiple delivery addresses.

## Related topics

* Guide: Requesting billing and multiple delivery addresses
* Guide: Offering distribution products
* Reference: Basket totals
* Reference: Items in the basket


## Related topics

- [MDM- (Multiple delivery addresses)](https://dokumentation.websale.de/en/v8s/referenz/tags/mdm-mehrere-lieferadressen.md)
- [D- (Delivery address)](https://dokumentation.websale.de/en/v8s/referenz/tags/d-lieferadresse.md)
- [Shipping and delivery](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/versand-und-lieferung.md)
- [Styles for customer and addresses](https://dokumentation.websale.de/en/v8s/referenz/styles/kunde-und-adressen.md)
- [Basket totals](https://dokumentation.websale.de/en/v8s/referenz/tags/basket/warenkorbsummen.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.