Skip to content
Cartly Developers

Cross-Border & Markets

Sell internationally with per-market currencies, translated content, and automatic GeoIP routing.

Overview

Markets let you define groups of countries that share a currency and language. Cartly automatically routes visitors to the matching market based on their IP country and serves market-specific prices and translated content.

A market defines:

  • countries — ISO-3166-1 alpha-2 codes
  • base_currency — display currency (e.g., "EUR")
  • default_locale / available_locales — supported languages
  • tax_inclusive — whether prices include VAT
  • duty_mode — "DDU" (buyer pays duties) or "DDP" (merchant pays)
  • is_primary — fallback market for unmatched countries

Markets CRUD

bashCreate a market
curl -X POST https://cartly.pro/admin/markets \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Europe",
    "countries": ["DE", "FR", "AT", "CH"],
    "base_currency": "EUR",
    "default_locale": "de",
    "available_locales": ["de", "fr"],
    "tax_inclusive": true,
    "duty_mode": "DDP",
    "active": true
  }'

Other market endpoints:

  • GET /admin/markets
  • GET /admin/markets/:id
  • PUT /admin/markets/:id
  • DELETE /admin/markets/:id
  • POST /admin/markets/:id/set-primary

Market Pricing

Override prices for specific variants in a market. When a per-market price exists, it replaces the variant base price in API responses for that market.

typescriptBulk set market prices
// Set per-variant market prices (bulk)
await fetch(`/admin/markets/${marketId}/prices`, {
  method: 'PUT',
  headers: {
    'Authorization': `Bearer ${ADMIN_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify([
    { variant_id: 'uuid-1', amount: 2499, compare_at: 2999 },
    { variant_id: 'uuid-2', amount: 4999 },
  ]),
});

GET /admin/markets/:id/prices — list all price overrides for a market.

You can also exclude products from a market entirely:POST /admin/markets/:id/exclusions with { "product_id": "..." }.

Translations

Translate any translatable field (title, description, etc.) for products, collections, pages, and articles per locale.

typescriptSet product translation
// Set German translation for a product
await fetch(`/admin/translations/product/${productId}/de`, {
  method: 'PUT',
  headers: {
    'Authorization': `Bearer ${ADMIN_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Klassisches T-Shirt',
    description: 'Weiches Baumwoll-T-Shirt in mehreren Farben.',
  }),
});

Translation endpoints:

  • GET /admin/translations/:type/:entityId — list all locales
  • PUT /admin/translations/:type/:entityId/:locale — upsert translations
  • DELETE /admin/translations/:type/:entityId/:locale — remove locale

type values: product, collection, page, article

Storefront Integration

The Headless Storefront API v1 supports locale-prefixed routes. Any catalog endpoint works under /storefront/v1/:locale/ and returns market-aware prices and translated content.

typescriptMarket-aware storefront API
// Market-aware Storefront API (German market)
const SAT = 'sat_your_token';
const BASE = 'https://cartly.pro/storefront/v1';

// Products with EUR pricing + German translations
const { products } = await fetch(`${BASE}/de/products`, {
  headers: { 'X-Shopify-Storefront-Access-Token': SAT },
}).then(r => r.json());
// products[0].currency === 'EUR'
// products[0].title === 'Klassisches T-Shirt'

// Hreflang links for SEO
const { hreflang } = await fetch(`${BASE}/seo/hreflang`, {
  headers: { 'X-Shopify-Storefront-Access-Token': SAT },
}).then(r => r.json());
// [{ locale: 'de', url: 'https://...' }, { locale: 'en', url: '...' }]

GeoIP Resolution

The Markets middleware reads the CF-IPCountry header set by Cloudflare. It looks up which market covers that country and injects market context into the request. If no market matches, the primary market is used as fallback.

For locale-prefixed routes (/storefront/v1/:locale/...), the locale parameter overrides GeoIP — useful for users who manually switch language/region.