Jump to content

alexm

Members
  • Posts

    694
  • Joined

  • Last visited

  • Days Won

    2

alexm last won the day on June 30 2021

alexm had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    UK

Recent Profile Visitors

3,972 profile views

alexm's Achievements

Hero Member

Hero Member (6/6)

278

Reputation

1

Community Answers

  1. @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.
  2. @kongondo I hadn't even noticed the email customer option!! That's wicked 🤙🏻
  3. @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!!! 👏🏻👊🏻
  4. 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!
  5. 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.
  6. 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 🤙🏻
  7. 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?
  8. 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.
  9. 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
  10. 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)
  11. @kongondo nice!! I saw your update. I'll await the link for renewal as per your update. Great work!! 👍🏻
  12. @adrian did you work out if this was possible? Was wanting to do the same thing. Cheers!
  13. @kongondo Word up my good man! How is the next release coming? This is not a pressure question, just came to mind and thought I'd touch base.
  14. @kongondo very nice!! How exciting. Did ya purposely not address then reveal fee part?! Haha. I’m sure it’s been over a year easily.
×
×
  • Create New...