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

# Climate-neutral production

> Offer buyers the option to offset the CO2 emissions of their order through a climate protection project at ClimatePartner.

During the ordering process, the buyer sees how much CO2 their order causes and can offset this amount for a fee through a climate protection project. After the order, they download their certificate. For the merchant, this is a matter of positioning; for the buyer, a voluntary decision in the checkout.

> [!WARNING]
>
> The interface to the climate protection projects, their costs and the certificates runs via ClimatePartner. Without a connection to ClimatePartner, the feature is not available.

## How it works

1. For each product, you specify whether it can be produced climate-neutrally. Such products need a weight.
2. If at least one such product is in the basket, the shop calculates the amount of CO2: total weight of these products times the CO2 factor. ClimatePartner determines the factor for your shop.
3. If the amount exceeds a configured minimum value, a list of climate protection projects supplied by ClimatePartner at that moment appears on the payment and shipping methods page.
4. If the buyer selects a project, the costs appear as global costs in the order overview.
5. When the order is completed, the certificate is ordered from ClimatePartner.
6. On the order confirmation, the buyer can download their certificate and configure the label.

## Setup

### Step 1: Activation

The feature must be activated.

> [!WARNING]
>
> If you use a merchandise management system, first clarify whether it supports climate-neutral production. Only start the integration after activation by WEBSALE AG.

### Step 2: Data from ClimatePartner

Before you begin, ClimatePartner's assessment of your company must be completed and three pieces of information must be available:

* Access credentials for the interface
* CO2 factor for calculating the emission amount from the weight
* Minimum emission amount

### Step 3: Flagging product data

Every product that should be orderable climate-neutrally gets the value `y` in the product data field `ClimateNeutral`. The details are in the product data documentation.

### Step 4: Configuration

```ini theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<ClimateNeutral>
   CO2Factor                     = 0.0017242
   MinCO2CompensationAmount      = 0.001
   VATRate-Value                 = 1
   VATType                       = static
   DecimalPlaces                 = 3
   DecimalSeparator              = ,
   ThousandSeparator             = .
   CertificateClient             = {A-Company}~A-Company~{/A-Company}{!A-Company}~A-Salutation~ ~A-FirstName~ ~A-LastName~{/!A-Company}
   CertificateOrderDescr         = Auftrag ~OrderNumber~ bei Ihrem Shopnamen
   CertificateRetrieval-Mode     = PerOrder
   CertificateRetrieval-TestMode =
   LanguageCode                  = de
   NotificationAddress           = admin@ihr-shop.de
   ClimateNeutral-Txt            =
   CostAddition-List             = (0:0.1)(0.1:100%)
   ClimatePartnerMinCost-Value   = 0.01
</ClimateNeutral>
```

| Parameter | Meaning |
| - | - |
| `CO2Factor` | Required. CO2 per unit of weight, determined by ClimatePartner |
| `MinCO2CompensationAmount` | Minimum amount of CO2 from which the option is offered |
| `VATRate-Value` | Required. Index of the VAT rate. If the calculation is invalid, the feature is omitted |
| `VATType` | `static` or `dynamic`, default `static` |
| `DecimalPlaces` | Decimal places of the displayed emission amount, default `2` |
| `DecimalSeparator`, `ThousandSeparator` | Separators for the emission amount |
| `CertificateClient` | Name of the buyer on the certificate |
| `CertificateOrderDescr` | Description of the order on the certificate |
| `CertificateRetrieval-Mode` | `PerOrder` for one certificate per order, `PerBasketPosition` for one per item |
| `CertificateRetrieval-TestMode` | the same for test mode |
| `LanguageCode` | two-letter code passed to ClimatePartner |
| `NotificationAddress` | Address for notifications about errors in the certificate order |
| `CostAddition-List` | Surcharge on the net costs, per tier in percent or euros |
| `ClimatePartnerMinCost-Value` | Minimum costs, `0.01` corresponds to one cent |

> [!WARNING]
>
> ClimatePartner always calculates in kilograms. If you store weights in the shop in a different unit, compensate for this via the CO2 factor. With a factor of 1.3 from ClimatePartner, the following applies:
>
> | Weights in the shop | Value to enter |
> | - | - |
> | Kilograms | `CO2Factor = 1.3` |
> | Grams | `CO2Factor = 0.0013` |
> | Tonnes | `CO2Factor = 1300` |

Reference: ClimateNeutral section

### Step 5: Display on the product

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{PR-ClimateNeutral}
   Dieses Produkt können Sie klimaneutral bestellen.
{/PR-ClimateNeutral}
```

### Step 6: Display in the basket

For each item, you can display whether it can be ordered climate-neutrally and how much CO2 is attributable to it.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{@BASKET-PR-Data}
   {BASKET-PR-ClimateNeutral}
      Diese Position kann klimaneutral bestellt werden.
      {BASKET-PR-ClimateNeutralCompensationAmount}
         CO2-Emission: ~BASKET-PR-ClimateNeutralCompensationAmount~ kg CO2
      {/BASKET-PR-ClimateNeutralCompensationAmount}
   {/BASKET-PR-ClimateNeutral}
{/@BASKET-PR-Data}
```

> [!NOTE]
>
> The CO2 amount cannot be shown for sub-products of a set. A set product always counts as one unit here.

### Step 7: Display for the entire basket

This notice can be placed anywhere in the shop, for example in the basket as a preview of the checkout.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{WS-ClimateNeutralActivated}
   {WS-ClimateNeutralForBasketAvailable}
      Ihr Warenkorb verursacht ~WS-ClimateNeutralCompensationAmount~ kg CO2-Emissionen.
      Sie können diese im Bestellprozess ausgleichen.
   {/WS-ClimateNeutralForBasketAvailable}
{/WS-ClimateNeutralActivated}
```

### Step 8: Selecting climate protection projects

The selection belongs on the payment and shipping methods page.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{WS-ClimateNeutralActivated}
   {CN-Data}

      <!-- erster Eintrag: kein Ausgleich -->
      <input type="radio" name="~CN-Project_radioname~" value="~CN-Project_radiovalue_noproject~"
             {CN-Project_radioselected_noproject}checked{/CN-Project_radioselected_noproject}>
      Keine klimaneutrale Produktion

      <!-- Schleife über die verfügbaren Projekte -->
      {@CN-Data}
         <input type="radio" name="~CN-Project_radioname~" value="~CN-Project_radiovalue~"
                {CN-Project_radioselected}checked{/CN-Project_radioselected}>
         Projektname: ~CN-ProjectName~<br>
         Technologie: ~CN-ProjectTechnology~<br>
         Region: ~CN-ProjectRegion~<br>
         Land: ~CN-ProjectCountry~<br>
         {CN-ProjectURL}<a href="~CN-ProjectURL~" target="_blank">Link zum Projekt</a><br>{/CN-ProjectURL}
         {CN-ProjectPDF}<a href="~CN-ProjectPDF~">Projektbeschreibung als PDF</a><br>{/CN-ProjectPDF}
         Kosten pro kg CO2: ~CN-ProjectPricePerUnit(3)~<br>
         Gesamtkosten: ~CN-ProjectTotal~<br>
      {/@CN-Data}

   {/CN-Data}
{/WS-ClimateNeutralActivated}
```

> [!NOTE]
>
> The first entry without a project is important. Without it, the buyer has no way to undo a choice once made.

Reference: All CN tags for climate-neutral production

### Step 9: Showing the costs

The costs belong to the globally shown costs such as shipping and payment method, i.e. before the grand total, on the order overview and on the order confirmation.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{BASKET-ClimateNeutral}
   {BASKET-ClimateNeutralTotal}
      Gesamt-Emissionsausgleich: ~BASKET-ClimateNeutralTotal~ ~WS-CurrencySymbol~
   {/BASKET-ClimateNeutralTotal}

   {BASKET-ClimateNeutralTotalVAT}
      Mehrwertsteueranteil: ~BASKET-ClimateNeutralTotalVAT~ ~WS-CurrencySymbol~
   {/BASKET-ClimateNeutralTotalVAT}
{/BASKET-ClimateNeutral}
```

For showing them separately, `BASKET-ClimateNeutralTotalNet` and `BASKET-ClimateNeutralTotalGross` are also available.

### Step 10: Certificate on the order confirmation

Which tags apply here depends on `CertificateRetrieval-Mode`. The structure is the same in both cases; only the tag names differ.

| Mode | Certificates | Tags |
| - | - | - |
| `PerOrder` | one for the entire order | `WS-ClimateNeutralCert…` |
| `PerBasketPosition` | one per basket item | `BASKET-PR-ClimateNeutralCert…`, enclosed in `WS-ClimateNeutralPerBasketPosition` and the loop over the items |

One certificate for the entire order:

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

   {WS-ClimateNeutralError}
      Das Zertifikat konnte nicht erzeugt werden. Bitte kontaktieren Sie uns.
   {/WS-ClimateNeutralError}

   {!WS-ClimateNeutralError}
      <b>Zertifikat der klimaneutralen Produktion</b><br>
      {WS-ClimateNeutralCertCreationDate}Ausstellungsdatum: ~WS-ClimateNeutralCertCreationDate~<br>{/WS-ClimateNeutralCertCreationDate}
      Projekt: ~WS-ClimateNeutralCertProjectName~<br>
      {WS-ClimateNeutralCertProjectURL}<a href="~WS-ClimateNeutralCertProjectURL~">Download des Zertifikats</a><br>{/WS-ClimateNeutralCertProjectURL}
      {WS-ClimateNeutralCertProjectLogo}<a target="_blank" href="~WS-ClimateNeutralCertProjectLogo~">Label konfigurieren</a><br>{/WS-ClimateNeutralCertProjectLogo}
      {WS-ClimateNeutralCertVerifyURL}<a target="_blank" href="~WS-ClimateNeutralCertVerifyURL~">zur Bestätigungsseite</a><br>{/WS-ClimateNeutralCertVerifyURL}
      Kompensierte Emissionsmenge: ~WS-ClimateNeutralCompensationAmount~<br>
   {/!WS-ClimateNeutralError}

{/BASKET-ClimateNeutral}

{!BASKET-ClimateNeutral}
   {WS-ClimateNeutralError}
      Die klimaneutrale Produktion ist im Moment leider nicht verfügbar.
   {/WS-ClimateNeutralError}
{/!BASKET-ClimateNeutral}
```

One certificate per item:

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{!WS-ClimateNeutralError}
   {WS-ClimateNeutralPerBasketPosition}
      <b>Zertifikate der klimaneutralen Produktion</b><br>
      {@BASKET-PR-Data}
         {BASKET-PR-ClimateNeutralAvailable}
            {BASKET-PR-ClimateNeutralCertCreationDate}Ausstellungsdatum: ~BASKET-PR-ClimateNeutralCertCreationDate~<br>{/BASKET-PR-ClimateNeutralCertCreationDate}
            Projekt: ~BASKET-PR-ClimateNeutralCertProjectName~<br>
            {BASKET-PR-ClimateNeutralCertProjectURL}<a href="~BASKET-PR-ClimateNeutralCertProjectURL~">Download des Zertifikats</a><br>{/BASKET-PR-ClimateNeutralCertProjectURL}
            Kompensierte Emissionsmenge: ~BASKET-PR-ClimateNeutralCompensationAmount~<br><br>
         {/BASKET-PR-ClimateNeutralAvailable}
      {/@BASKET-PR-Data}
   {/WS-ClimateNeutralPerBasketPosition}
{/!WS-ClimateNeutralError}
```

> [!NOTE]
>
> In `PerBasketPosition` mode, `MinCO2CompensationAmount`, `ClimatePartnerMinCost-Value` and `CostAddition-List` are applied to each item individually. A set product counts as one product.

## Distinguishing the two error cases

Before the order is completed, the certificate is reserved at ClimatePartner; it is only created afterwards. This results in two error scenarios, which are enclosed differently in the template and have very different consequences.

| Error | Enclosure | Costs in the order | What to do |
| - | - | - | - |
| Reservation succeeded, certificate order failed | `{BASKET-ClimateNeutral}` and within it `{WS-ClimateNeutralError}` | included | check and complete the order at ClimatePartner manually. An email to `NotificationAddress` points this out |
| Reservation failed | `{!BASKET-ClimateNeutral}` and within it `{WS-ClimateNeutralError}` | not included, the selection was reset | nothing |

> [!WARNING]
>
> The first case means that the buyer has paid for something that has not yet been ordered. The address in `NotificationAddress` must therefore be read by someone who can respond.

## Related topics

* Guide: Displaying the basket
* Guide: Payment and shipping methods
* Guide: Order overview and order confirmation


## Related topics

- [CN- (Climate-neutral production)](https://dokumentation.websale.de/en/v8s/referenz/tags/cn.md)
- [Climate-neutral production in the basket](https://dokumentation.websale.de/en/v8s/referenz/tags/basket/klimaneutrale-produktion-im-warenkorb.md)
- [Prices, taxes, and currency](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/preise-steuern-und-waehrung.md)
- [Shopping cart, prices, currency and bonus](https://dokumentation.websale.de/en/v8s/referenz/tags/ws/warenkorb-preise-waehrung-und-bonus.md)
- [External services: Overview](https://dokumentation.websale.de/en/v8s/externe-dienste/externe-dienste.md)


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