> ## 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.

# D- (Delivery address)

> The tags for the alternative delivery address: build input fields and selection lists, manage, search and select saved delivery addresses, also for multiple delivery addresses per order.

The tags with the prefix `D-` represent the alternative delivery address. They are the mirror image of the `A-` tags for the billing address and follow the same blueprint: a technical field name to which a suffix is appended.

Beyond that, a delivery address can do something that a billing address cannot. A customer may save several of them, set one of them as the default and even use several at the same time in one order. The additional groups on this page exist for this purpose.

Guide: Requesting an alternative delivery address · Reference: A- (Billing address)

## Where the field names come from

The basic fields of the delivery address are defined in the `shop.config` shop configuration in the `<DeliveryAddressFields-Txt>` section. The parameter name is the technical field name, the value after it is the label.

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<DeliveryAddressFields-Txt>
   FirstName = Vorname
   LastName  = Nachname
   ...
</DeliveryAddressFields-Txt>
```

From `FirstName`, this results in `D-FirstName`, `D-FirstName_input`, `D-FirstName_text` and all other suffixes.

Reference: `<DeliveryAddressFields-Txt>` section

## A complete input field

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{D-FirstName_visible}
   <label for="~D-FirstName_input~" class="label~D-FirstName_error~">
      ~D-FirstName_text~{D-FirstName_required} *{/D-FirstName_required}
   </label>

   <input type="text"
          id="~D-FirstName_input~"
          name="~D-FirstName_input~"
          maxlength="~D-FirstName_max~"
          value="~D-FirstName~"
          class="input~D-FirstName_error~">

   {D-FirstName_errormessage}
      <span class="fehler">~D-FirstName_errormessage~</span>
   {/D-FirstName_errormessage}
{/D-FirstName_visible}
```

> [!WARNING]
>
> The example in the source writes `~D-FirstName_error` without a closing tilde in the `class` attribute of the input field. Typed like that, the tag name remains as text in the markup. Make sure that every tag is enclosed by two tildes.

### The suffixes on the input field

| Suffix | Returns |
| - | - |
| none | the entered value |
| `_input` | the technical name of the input field |
| `_text` | the label from the shop configuration |
| `_max` | the maximum input length |
| `_required` | applies if the field is a required field |
| `_visible` | applies if the field is to be displayed |
| `_readonly` | applies if the field cannot be changed |
| `_error` | applies in case of incorrect input; as a single tag, it results in the class `_error` |
| `_errormessage` | the error message stored for the field and the type of check |
| `_action` | applies if a dependency is stored for this field |
| `_hiddeninputflagdeleted` | the name of a hidden field that explicitly reports a deletion |

> [!NOTE]
>
> `_visible` and `_required` depend on the shop configuration. Wrap every field in `_visible`; it then disappears automatically if it is not needed for the selected country or the selected address type.

> [!NOTE]
>
> `_error` as a single tag results in the string `_error`. In the example, this becomes the class `input_error` as long as there is an error, and `input` otherwise. This way, you do not need a second wrapper just for styling.

### Input-dependent control

`_action` applies if a dependency is stored for this field in the `<AddressFields-Actions>` section. The template must then have the address input reloaded.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<input type="text" name="~D-Company_input~" value="~D-Company~"
       {D-Company_action}onblur="ws_AJAXRefreshAddressInput('addressform','~BT-Addr_Refresh~','~WS-Charset~')"{/D-Company_action}>
```

> [!NOTE]
>
> The wrapper prevents an action from being attached to every field. Only the fields for which a dependency actually exists trigger the reload.

### Explicitly reporting a field as deleted

If the buyer clears a field, this is often only transmitted to a connected system as "not changed", and the old value remains there. With `_hiddeninputflagdeleted`, you report the deletion explicitly.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<input type="hidden" name="~D-Suffix1_hiddeninputflagdeleted~" value="true">
```

> [!NOTE]
>
> If an empty field is to be transmitted but not marked as deleted, leave `value` empty.

## Selection lists

For fields with a fixed set of values, for example the country, the template builds the selection list itself from four suffixes.

| Suffix | Role |
| - | - |
| `_data` | loop over the entries |
| `_code` | the technical value of the entry |
| `_value` | the name of the entry |
| `_selected` | results in `selected` for the selected entry |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<select name="~D-Country_input~">
   {@D-Country_data}
      <option value="~D-Country_code~" ~D-Country_selected~>~D-Country_value~</option>
   {/@D-Country_data}
</select>
```

> [!WARNING]
>
> The suffix `_list` generates a ready-made selection list, but will no longer be supported in the next version of WEBSALE V8s. Build new templates with the four suffixes above; then you can also style the list.

Guide: Selection lists for address data

## Special fields

| Tag | Returns |
| - | - |
| `D-CountryISO` | the three-letter ISO code of the selected delivery country |
| `D-SalutationCode` | the technical code of the salutation from `salutation.dat` |
| `D-TitleCode` | the technical value of the title |
| `D-DateOfBirth_list` | three ready-made selection lists for day, month and year |

> [!NOTE]
>
> `D-CountryISO`, `D-SalutationCode` and `D-TitleCode` are intended for passing on to connected systems. To the buyer, you show `D-Country`, `D-Salutation` and `D-Title`, i.e. the plain text versions.

> [!NOTE]
>
> The shop generates the three selection lists from `D-DateOfBirth_list` itself. They can be styled via the class `select_date_of_birth`, which is assigned to all three, and via the IDs `ws_input_delivery_date_of_birth_day`, `ws_input_delivery_date_of_birth_month` and `ws_input_delivery_date_of_birth`.

> [!WARNING]
>
> The ID of the year list has no suffix and is simply called `ws_input_delivery_date_of_birth`. If you address it with `_year` following the pattern of the other two, you will not hit anything.

## The saved delivery addresses

### D-LoadData

Loads all saved delivery addresses of the logged-in customer. Only after that do the other D- tags return anything outside the checkout process.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
~D-LoadData~
<p>Hinterlegte Lieferadressen: {D-Data}~D-Data~{/D-Data}{!D-Data}keine{/!D-Data}</p>
```

> [!WARNING]
>
> The tag only takes effect for a logged-in customer and only via an encrypted connection. On a page without HTTPS or for a guest, it has no effect, and the subsequent tags return nothing.

> [!WARNING]
>
> Every call retrieves the addresses from the database. Therefore, do not place the tag globally in the page header, but only where you really need the data.

### D-Data

The central tag of address management, in three roles.

| Usage | Result |
| - | - |
| Single tag | the number of saved delivery addresses |
| Range tag | applies if at least one is saved |
| Loop tag | iterates over the saved addresses |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{D-Data}
   Sie haben ~D-Data~ Lieferadressen gespeichert.

   {@D-Data}
      ~D-FirstName~ ~D-LastName~<br>
      ~D-Street1~<br>
      ~D-Zip~ ~D-City~<br>
      ~D-Country~
      {D-IsDefault}<span class="marke">Standard</span>{/D-IsDefault}
   {/@D-Data}
{/D-Data}

{!D-Data}
   Sie haben noch keine Lieferadresse gespeichert.
{/!D-Data}
```

### The default delivery address

| Tag | Purpose |
| - | - |
| `D-IsDefault` | applies to the address that is set as the default |
| `D-SetAsDefaultLink` | link for setting the default; applies only to addresses that are not yet the default |
| `D-RemoveDefaultLink` | link for removing the default; applies only if one is set at all |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{@D-Data}
   ...
   {D-IsDefault}
      Standard-Lieferadresse
   {/D-IsDefault}

   {D-SetAsDefaultLink}
      <a href="~D-SetAsDefaultLink~">Als Standard festlegen</a>
   {/D-SetAsDefaultLink}
{/@D-Data}

{D-RemoveDefaultLink}
   <a href="~D-RemoveDefaultLink~">Standard entfernen</a>
{/D-RemoveDefaultLink}
```

> [!NOTE]
>
> `D-IsDefault` and `D-SetAsDefaultLink` belong inside the loop because they refer to the individual address. `D-RemoveDefaultLink` belongs outside, because there is only one default address and therefore only one link for removing it.

> [!NOTE]
>
> If the default is removed, the shop preselects the most recently used delivery address or the billing address, depending on the setting.

Guide: Setting a default delivery address

### D-OneTime

Applies if the selected delivery address is used once and is not saved in the customer account.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{D-OneTime}
   Einmalig verwendete Lieferadresse
{/D-OneTime}

{!D-OneTime}
   Im Kundenkonto gespeicherte Lieferadresse
{/!D-OneTime}
```

## Searching the delivery addresses

Anyone who has saved twenty or more delivery addresses needs a search.

| Tag | Returns |
| - | - |
| `D-SearchInput` | the name of the search field |
| `D-SearchTerm` | the entered search term; as a range, it applies as soon as a search has been performed |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<form action="~FORM-DelivAddrSearch~" method="post">
   <input type="text" name="~D-SearchInput~" value="~D-SearchTerm~">
   <input type="submit" name="~BT-DelivAddrSearch~" value="finden">

   {D-SearchTerm}
      <a href="~WS-DelivAddrManageLink~">Suche zurücksetzen</a>
   {/D-SearchTerm}
</form>
```

> [!WARNING]
>
> Both tags and the button must be placed within the `FORM-DelivAddrSearch` form. In another form on the same page, the search has no effect.

> [!NOTE]
>
> The reset link only appears if a search has actually been performed. Without it, the buyer can only return to the full list by calling up the page again.

Guide: Offering full-text search for multiple customer data

## Selecting a saved address

In the checkout process, the buyer selects from their saved delivery addresses. `D-DeliverySelection` with four suffixes is available for this.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{D-DeliverySelection}
   <select name="~D-DeliverySelection_input~">
      {@D-Data}
         <option value="~D-DeliverySelection_value~"
                 {D-DeliverySelection_selected}selected{/D-DeliverySelection_selected}>
            {D-UserDescr}~D-UserDescr~, {/D-UserDescr}~D-FirstName~ ~D-LastName~, ~D-Country~
         </option>
      {/@D-Data}
   </select>
{/D-DeliverySelection}

{D-DeliverySelection_error}
   Bei der Auswahl ist ein Fehler aufgetreten.
{/D-DeliverySelection_error}
```

> [!WARNING]
>
> The four suffixes `_input`, `_error`, `_selected` and `_value` work exclusively within the positive range `{D-DeliverySelection}`. Outside of it, they are invalid. This is the same pattern as for selecting the bank account and the credit card.

> [!NOTE]
>
> The outer range applies if any saved delivery addresses exist at all. The selection list thus disappears automatically if there is nothing to select.

## Multiple delivery addresses per order

With MultiDelivery, each shopping basket position goes to its own delivery address. The management template for this needs a second set of suffixes, recognizable by the `mdm` in the name.

| Tag | For |
| - | - |
| `D-DeliverySelection_mdm_input` | the name of the selection group for saved addresses |
| `D-DeliverySelection_mdm_value` | the value of this saved address |
| `D-DeliverySelection_mdm_selected` | applies if this saved address is selected |
| `D-DeliverySelection_mdm_editmode_buttonvalue` | the value of the change button for a saved address |
| `D-DeliverySelection_mdm_onetime_input` | the name of the selection group for one-time addresses |
| `D-DeliverySelection_mdm_onetime_value` | the value of this one-time address |
| `D-DeliverySelection_mdm_onetime_selected` | applies if this one-time address is selected |
| `D-DeliverySelection_mdm_onetime_editmode_buttonvalue` | the value of the change button for a one-time address |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{MDM-Destination_radioselected_saveddelivaddress}
   {@D-Data}
      <input type="radio"
             name="~D-DeliverySelection_mdm_input~"
             value="~D-DeliverySelection_mdm_value~"
             {D-DeliverySelection_mdm_selected}checked{/D-DeliverySelection_mdm_selected}>

      <label>~D-FirstName~ ~D-LastName~<br>~D-Street1~<br>~D-Zip~ ~D-City~</label>

      <button type="submit"
              name="~MDM-EditMode_buttonname~"
              value="~D-DeliverySelection_mdm_editmode_buttonvalue~">ändern</button>
   {/@D-Data}
{/MDM-Destination_radioselected_saveddelivaddress}
```

> [!WARNING]
>
> The two sets must not be mixed. The tags without `onetime` apply to saved addresses, those with `onetime` to addresses used once. For a saved address, `mdm_onetime_editmode_buttonvalue` returns nothing, and vice versa.

> [!NOTE]
>
> Unlike the four suffixes in the previous section, the `mdm` tags do not need to be wrapped in `{D-DeliverySelection}`. They work independently of it, but belong inside the `{@D-Data}` loop.

### How often an address is used

| Tag | Applies |
| - | - |
| `D-MultiDeliveryUsed` | if the loaded address is used at least once |
| `D-MultiDeliveryMultipleUsed` | if it is used multiple times; as a single tag, it outputs the number |
| `D-MultiDeliveryBillAddressUsed` | if the billing address is used as the delivery address |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{D-MultiDeliveryMultipleUsed}
   Diese Adresse wird ~D-MultiDeliveryMultipleUsed~ mal beliefert.
{/D-MultiDeliveryMultipleUsed}
```

Guide: Selecting multiple delivery addresses · Reference: Tags for multiple addresses

## Tag overview

### The suffixes on the field

| Tag | Single tag | Range tag | Negative range tag | Loop tag |
| - | - | - | - | - |
| `D-<Feld>` | yes | yes | yes | – |
| `D-<Feld>_input` | yes | yes | yes | – |
| `D-<Feld>_text` | yes | yes | yes | – |
| `D-<Feld>_max` | yes | yes | yes | – |
| `D-<Feld>_error` | yes | yes | yes | – |
| `D-<Feld>_errormessage` | yes | yes | yes | – |
| `D-<Feld>_visible` | yes | yes | yes | – |
| `D-<Feld>_required` | – | yes | yes | – |
| `D-<Feld>_readonly` | – | yes | yes | – |
| `D-<Feld>_action` | – | yes | yes | – |
| `D-<Feld>_hiddeninputflagdeleted` | yes | – | – | – |
| `D-<Feld>_data` | – | – | – | yes |
| `D-<Feld>_code` | yes | – | – | – |
| `D-<Feld>_value` | yes | – | – | – |
| `D-<Feld>_selected` | yes | – | – | – |

### The other tags

| Tag | Single tag | Range tag | Negative range tag | Loop tag |
| - | - | - | - | - |
| `D-CountryISO` | yes | – | – | – |
| `D-SalutationCode` | yes | yes | yes | – |
| `D-TitleCode` | yes | yes | yes | – |
| `D-DateOfBirth_list` | yes | – | – | – |
| `D-LoadData` | yes | – | – | – |
| `D-Data` | yes | yes | yes | yes |
| `D-IsDefault` | – | yes | yes | – |
| `D-SetAsDefaultLink` | yes | yes | yes | – |
| `D-RemoveDefaultLink` | yes | yes | yes | – |
| `D-OneTime` | – | yes | yes | – |
| `D-SearchInput` | yes | – | – | – |
| `D-SearchTerm` | yes | yes | yes | – |
| `D-DeliverySelection` | yes | yes | yes | – |
| `D-DeliverySelection_input` | yes | – | – | – |
| `D-DeliverySelection_value` | yes | – | – | – |
| `D-DeliverySelection_selected` | – | yes | yes | – |
| `D-DeliverySelection_error` | yes | yes | yes | – |
| `D-DeliverySelection_mdm_input` | yes | – | – | – |
| `D-DeliverySelection_mdm_value` | yes | – | – | – |
| `D-DeliverySelection_mdm_selected` | – | yes | yes | – |
| `D-DeliverySelection_mdm_editmode_buttonvalue` | yes | – | – | – |
| `D-DeliverySelection_mdm_onetime_input` | yes | – | – | – |
| `D-DeliverySelection_mdm_onetime_value` | yes | – | – | – |
| `D-DeliverySelection_mdm_onetime_selected` | – | yes | yes | – |
| `D-DeliverySelection_mdm_onetime_editmode_buttonvalue` | yes | – | – | – |
| `D-MultiDeliveryUsed` | – | yes | yes | – |
| `D-MultiDeliveryMultipleUsed` | yes | yes | yes | – |
| `D-MultiDeliveryBillAddressUsed` | – | yes | yes | – |

## Related topics

* Guide: Requesting an alternative delivery address
* Guide: Selection lists for address data
* Guide: Setting a default delivery address
* Guide: Selecting multiple delivery addresses
* Reference: A- (Billing address)
* Reference: Tags for multiple addresses


## Related topics

- [Shipping and delivery](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/versand-und-lieferung.md)
- [Buttons for addresses](https://dokumentation.websale.de/en/v8s/referenz/tags/bt/adressen.md)
- [MDM- (Multiple delivery addresses)](https://dokumentation.websale.de/en/v8s/referenz/tags/mdm-mehrere-lieferadressen.md)
- [Multiple delivery addresses and sample copies](https://dokumentation.websale.de/en/v8s/referenz/tags/basket/mehrfach-lieferadressen-und-belegexemplare.md)
- [A- (Billing address)](https://dokumentation.websale.de/en/v8s/referenz/tags/a-rechnungsadresse.md)


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