In this short guide, I will tell you how to use Spreadshirt's shop, country and currency data to format your prices correctly.

Formatting Rules

For formatting a price we need the following data:

Where do we get this data from? A shop, such as shop 205909, is actually configured for a specific country and currency. A sample payload is illustrated below:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<shop xmlns:xlink="http://www.w3.org/1999/xlink"
      xmlns="http://api.spreadshirt.net"
      xlink:href="http://api.spreadshirt.net/api/v1/shops/205909" id="205909">
    <user xlink:href="http://api.spreadshirt.net/api/v1/users/40000" id="40000"/>
    <country xlink:href="http://api.spreadshirt.net/api/v1/countries/1" id="1"/>
    <language xlink:href="http://api.spreadshirt.net/api/v1/languages/1" id="1"/>
    <currency xlink:href="http://api.spreadshirt.net/api/v1/currencies/1" id="1"/>
    ...
</shop>

The currency, such as currency 1 defines the currency symbol, the price pattern and the decimal count.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<currency xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns="http://api.spreadshirt.net"
          xlink:href="http://api.spreadshirt.net/api/v1/currencies/1" id="1">
    <plain>EUR</plain>
    <isoCode>EUR</isoCode>
    <symbol>€</symbol>
    <decimalCount>2</decimalCount>
    <pattern>% $</pattern>
</currency>

The country, such as country 1 defines the thousands separator and the decimal point.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<country xmlns:xlink="http://www.w3.org/1999/xlink"
         xmlns="http://api.spreadshirt.net"
         xlink:href="http://api.spreadshirt.net/api/v1/countries/1" id="1">
    <isoCode>DE</isoCode>
    <thousandsSeparator>.</thousandsSeparator>
    <decimalPoint>,</decimalPoint>
    <length>
        <unit>cm</unit>
        <unitFactor>1.0</unitFactor>
    </length>
    <currency xlink:href="http://api.spreadshirt.net/api/v1/currencies/1" id="1"/>
</country>

Example