-
Posts
710 -
Joined
-
Last visited
-
Days Won
2
Everything posted by alexm
-
Tax Rounding issue (and proposed solution)
alexm replied to alexm's topic in ProcessWire Commerce (Padloper) Support
OH EM GEEEE!! Wicked well done man -
Hey @kongondo and @Spinbox. Did you get the add to cart feature etc working with URL segments on on the homepage? I too have an instance, where the homepage has URL segments enabled and when enabled the padloper/add/ segments aren't processed correctly. When disabled, of course addToCart and the url segments are handled correctly. The thing is, I'd ideally like URL segments enabled as they convert LoginRegister's get url params to url segments.
-
Tax Rounding issue (and proposed solution)
alexm replied to alexm's topic in ProcessWire Commerce (Padloper) Support
No drama! Thank you for your efforts as always mate -
Tax Rounding issue (and proposed solution)
alexm replied to alexm's topic in ProcessWire Commerce (Padloper) Support
@kongondo you da man! ? -
Tax Rounding issue (and proposed solution)
alexm replied to alexm's topic in ProcessWire Commerce (Padloper) Support
@Spinbox I'm pretty certain @kongondo is working on a revision of the tax calculation from our discussions. I'll let him clarify that though when he's free. -
@kongondo I hadn't even noticed the email customer option!! That's wicked ??
-
@kongondo great work as always! Loving how easy it is to use the new customers and customer groups to create a custom dashboard for them. I've made an address book so that customers can create/update/delete addresses with ease and view/manage their orders. Next up will be to integrate the address book into the customer information form at checkout, rather than set the default address. This will be fun to work on ? Likewise, it was straightforward to get the discount codes feature integrated and this is working very well indeed. Really can't applaud your work on this big update enough!!! ????
-
Tax Rounding issue (and proposed solution)
alexm replied to alexm's topic in ProcessWire Commerce (Padloper) Support
Yeah I suspected as much from your original list of Requirements php settings wise. Well I've asked about and that would be my logic to remedy said totalling matter boss! -
Tax Rounding issue (and proposed solution)
alexm replied to alexm's topic in ProcessWire Commerce (Padloper) Support
Just taking this one step further again. If it is an instance where people want to display their prices for products on the site NET (e.g. B2B or American standard I believe) then you would show a product that is listed on the backend of the website at £3.50 with prices configured as inclusive of VAT, on the frontend as £2.92. Then at checkout you'd simply change the logic to calculate taxes for that case as so (2.92 x 10) x 1.2 = £35.04 That would be the true expectation of the price based on what the customer sees on those kind of stores where product prices should be displayed net of VAT I'll leave it there. Haha. -
Tax Rounding issue (and proposed solution)
alexm replied to alexm's topic in ProcessWire Commerce (Padloper) Support
Or disregard displaying the unit price exclusive of tax it tax is enabled altogether and instead simply show the tax amount for all items as above: Total Price Excluding Tax: £29.16 VAT Amount (20%): £5.84 Total Price Including Tax: £35.00 ?? -
Tax Rounding issue (and proposed solution)
alexm replied to alexm's topic in ProcessWire Commerce (Padloper) Support
Interesting!! I think bcmath is ideal for the job as you've opted for, for sure. And I'm pretty certain (from my understanding) that calculating the tax from the total of each line item is the best way to avoid discrepancies. Of course, I see your pain, because if you then wanted to display the unit price excl. tax for that line item you would indeed arrive at £2.92. And then if you ((2.92 x 10) * 1.2) you arrive at 35.04. But looping back round. For the total and accurate tax calculation of the product price which includes tax, then I think it better and more accurate to display the tax based on the line total and then a small note can always be added explaining that 'taxes are calculated on the total of each line item'. So then if we do show the price excl. tax per item and it's marginally different, the methodology is explained? -
Tax Rounding issue (and proposed solution)
alexm replied to alexm's topic in ProcessWire Commerce (Padloper) Support
And using bcmath inline with Padloper: $price_per_item = '3.50'; $quantity = '10'; $vat_rate = '20'; // in percentage // Calculate the total price including tax $total_price_incl_tax = bcmul($price_per_item, $quantity, 2); // Calculate the total price excluding tax $divisor = bcadd('1', bcdiv($vat_rate, '100', 2), 2); $total_price_excl_tax = bcdiv($total_price_incl_tax, $divisor, 2); // Calculate the VAT amount $vat_amount = bcsub($total_price_incl_tax, $total_price_excl_tax, 2); // Output the results echo "Total Price Excluding Tax: £" . number_format($total_price_excl_tax, 2) . "\n"; echo "VAT Amount (20%): £" . number_format($vat_amount, 2) . "\n"; echo "Total Price Including Tax: £" . number_format($total_price_incl_tax, 2) . "\n"; This will output: Total Price Excluding Tax: £29.16 VAT Amount (20%): £5.84 Total Price Including Tax: £35.00 Which again is accurate and gives the true total. -
Tax Rounding issue (and proposed solution)
alexm replied to alexm's topic in ProcessWire Commerce (Padloper) Support
Ok I've found the issue. This is due to the tax being calculated for each item then multiplied by 10 giving you the lower figure that doesn't round to £35. The more accurate way to calculate taxes for each line of items and arrive back at £35 (inline with the true product price) is to calculate the tax on the total figure for that line of items, not on one item then multiplying that. By my testing and judgment (though I'll happily be told my logic is wrong ?) is as below: $price_per_item = 3.50; $quantity = 10; $vat_rate = 20; // in percentage // Calculate the total price including tax $total_price_incl_tax = $price_per_item * $quantity; // Calculate the total price excluding tax $total_price_excl_tax = round($total_price_incl_tax / (1 + $vat_rate / 100), 2); // Calculate the VAT amount $vat_amount = round($total_price_incl_tax - $total_price_excl_tax, 2); echo "Total Price Excluding Tax: £" . number_format($total_price_excl_tax, 2) . "\n"; echo "VAT Amount (20%): £" . number_format($vat_amount, 2) . "\n"; echo "Total Price Including Tax: £" . number_format($total_price_incl_tax, 2) . "\n"; This will output: Total Price Excluding Tax: £29.17 VAT Amount (20%): £5.83 Total Price Including Tax: £35.00 Which is accurate -
Hi @kongondo I'm just testing the tax calculations and the rounding doesn't seem to be handled quite right. The product is £3.50 and charge taxes on this product is enabled. The store also has 'All taxes are included in stated prices' checked under tax settings and tax is set at 20%. On cart page the total for 10 of this item is £35. Once I get to the checkout confirmation the total after the tax calculation is £34.92 (see screenshot)
-
@adrian did you work out if this was possible? Was wanting to do the same thing. Cheers!
-
Hi @kongondo, A customer has just had an order and charge taxes was on for one of the products that was ordered, so VAT was showing on the order. They asked if I can switch it off and foolishly, I went and edited it under Admin -> Shop -> Padloper -> Orders and there was an option to disable taxes on the order, so I hit that and then save and the items have disappeared from the order. Is there a way I can manually add them back in?!! EEEEEEEEK