Selling in more than one currency
Rentals follows whatever currencies the store sells in. With one currency nothing on this page applies and nothing about the add-on looks any different. Turn on a second one in KahunaCart's currency settings and a property can be priced in it.
The one rule behind all of it is the one the rest of KahunaCart uses: an amount nobody typed in a currency is never free and never the dollar number. It means that thing does not exist in that currency.
What gets a price in each currency
A stay is built from a handful of amounts, and each of them can be given in every currency the store sells in:
- The property's own price a night. Set on the product, or on the option, in KahunaCart → Products, next to the price in your own currency. Rentals reads it and keeps no copy.
- Each rate band's nightly price and its weekend price. On the Rates tab, under the band's price, there is a box for each other currency.
- The cleaning fee, the extra-guest rate, the damage deposit and the monthly rate. On the property's booking rule, under Who it sleeps, and what they pay, there is a row of four boxes for each other currency.
Each box is typed the way that currency is written: 230.00 for euros, 35000 for yen, 3.500 for a currency with three decimal places. A box left empty takes the amount away.
A band that is a percentage of the property's own price needs nothing in other currencies. A night in it costs that percentage of whatever the property costs in the currency being asked for.
Not available in this currency
If a night has no price in the currency a guest is looking at, the night is not on offer in it. The calendar says Not available in EUR. and a stay across it is refused with the same words. The same night is still bookable in dollars, and a guest who switches back sees it.
The strict reading, because it is the one that cannot undercharge:
- A band that covers a night but has no price in the currency makes that night unavailable. It is not skipped and it does not fall back to a cheaper band or to the property's own price. Skipping it would quietly lose the band's minimum stay and arrival days along with its price. The Rates tab says which bands have no price in a currency, under the year, and
bin/plugin kahunacart-rentals nights <product> --currency=EURmarks each night that has none. - A weekend night needs a weekend price in the currency when the band it falls in has a weekend rate in your own currency. A band with no weekend rate in yours has none to be missing.
- A night no band covers uses the property's own price in the currency. If the property has none in it, those nights are not available.
- The band's own rules still apply. Its minimum stay and its arrival days are not currencies, so a stay in euros is held to them exactly as a stay in dollars is.
Fees with no amount in a currency
A cleaning fee, an extra-guest rate, a damage deposit or a monthly rate with no amount in the currency is no such charge there. It is never the dollar figure under another code. The stay is still sold, without it.
That means a property priced in euros and not given a cleaning fee in euros has no cleaning fee in euros. If you want one, type it. The row of boxes on the booking rule says so under them.
A monthly rate in a currency with no monthly amount means a long stay in that currency is priced night by night. Every night of the stay still needs a price in the currency, even the ones that would have been inside a month.
What a guest sees
The picker, the calendar and the summary under it show every figure in the currency the guest is browsing in, with that currency's own decimal places. The page sends the currency with each request, so the price on the page, the dates that are held and the line in the basket are all in the same one.
An option nobody priced in the guest's currency says Not available in EUR where its price would be, and picking it shows that sentence in place of the summary.
If a guest holds dates in one currency and then switches currency before they check out, the basket refuses the held dates with a sentence asking them to pick again. A stay quoted at 890.00 euros is not 890.00 dollars. A hold made before the store had a second currency is in the store's own, and is treated that way.
What happens after somebody has booked
Everything after a stay is paid for is in the currency of the order it was paid with, whatever the guest is browsing in later and whatever your own currency is:
- The deposit and the balance. Thirty per cent of a stay in euros is thirty per cent of the euro total, and the balance reminder says the euro amount.
- The damage deposit. It is the property's damage deposit in the stay's currency, in the receipt, the manage page and the pre-arrival email. A property with none set in that currency has none to mention there, and the email says nothing about one.
- A cancellation. The sentence on the refund request works from what the shop is holding for that stay, in that currency, and says it in that currency.
- A move to other dates. It is priced in the stay's currency.
From the command line
bin/plugin kahunacart-rentals nights <product> --currency=EUR prices and lists the nights in a currency. --quote=A..B prices the stay in it. Without --currency the output is what it always was, and the amounts are said through core's formatter, so yen has no decimals.
The API and the MCP tools
GET /kahunacart/rentals/quote takes currency, and the quote it hands back carries currency. A currency the store does not sell in is a 422 with a sentence. The rules and rates routes carry currency_amounts on a store with more than one currency and take it back on a save, in core's format: {"EUR": {"cleaning_fee": "130.00"}}, where an empty string removes an amount and a name left out is left alone.
On a store with one currency none of those keys appears, and a save that sends currency_amounts is refused with a sentence saying the store has one currency.
Related
- Rates and seasons - the rate card
- Taking payment - the deposit, the balance and cancellation
- Currencies - how a store is set up to sell in more than one
- Developers - the quote route, the engine and the events