Closed rrelmy closed 3 years ago
😕 I can't reproduce the issues after changing the currency to swiss francs and a .
delimiter
'currency_name' => 'CHF',
'currency_isoCode' => 'CHF', // Make sure to use ISO_4217 https://en.wikipedia.org/wiki/ISO_4217
'currency_symbol' => 'CHF',
'currency_delimiter' => '.',
but it shows another issue, multiple taxes even if only one (7.7) is configured
I'll check for a bugfix.
Thanks for reaching out.
I can't reproduce the issue right now. Please reopen in case you will run into this again.
Describe the bug
The butik does not play very well with taxes with a decimal (example: 7.7% in switzerland). In the cp there is no issue, everything can be created as expected with floats, but in the frontend there are multiple issues (there might be more than I found!)
How to reproduce
Steps to reproduce the behavior:
7.7
Items can not be added to the basket
Looks like on this line a
string
is passed into afloat
variable https://github.com/jonassiewertsen/statamic-butik/blob/e5ff7a9d0ad2a6c1485deafbebcfdb4797e645e8/src/Checkout/Item.php#L110Further errors have been found after changing the line to
$this->taxRate = (float) $item->tax->percentage;
so I could continueReturn value of Jonassiewertsen\StatamicButik\Shipping\ShippingAmount::taxPercentage() must be of the type int, string returned
Another case that returns float/string instead of int https://github.com/jonassiewertsen/statamic-butik/blob/e5ff7a9d0ad2a6c1485deafbebcfdb4797e645e8/src/Shipping/ShippingAmount.php#L68
I did not check the rest of the code!
Wrong tax percentage displayed in cart (Might be an issue in the starter kit and not the addon)
Only
7
instead of7.7
is displayedTax calculation is based on the int value instead of float
€ 192,00 VAT displayed € 12,56 Expected 13.73 (if I didn't made a mistake, 192-(192/107.7*100))
Expected behavior
It should just work :shrug:
Environment
Statamic 3.0.49 Solo Laravel 8.41.0 PHP 7.4.16 jonassiewertsen/statamic-butik 3.5.5 jonassiewertsen/statamic-livewire 2.5.0