Show prices with tax/without tax toggle

  • Posts: 66
  • Thank you received: 1
1 year 4 months ago #353304

-- HikaShop version -- : 4.7.47
-- Joomla version -- : 3.10.11
-- PHP version -- : 7.4.33

Is there a way to have a toggle at the top of the page (as a module) which can be toggled to show prices with and without tax?

All prices are shown on the page, but then then style is updated.

For example, when the toggle is set to show prices with tax, the style would be:

<div class="productPrices">
<div class="priceswithTax bold">£120.00</div>
<div class="priceswithoutTax">£100.00</div>
</div>

the if the toggle is set to show prices without tax, the style would be:

<div class="productPrices">
<div class="priceswithoutTax bold">£100.00</div>
<div class="priceswithTax">£120.00</div>
</div>

I can then style them accordingly. What the best way to do this please?

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 4 months ago #353308

Hi,

You'll have to develop a module ( docs.joomla.org/J3.x:Creating_a_simple_m...oping_a_Basic_Module ) with your toggle button and a dozen lines of javascript code ( stackoverflow.com/questions/67881886/how...iner-with-javascript ) to do the swap.
Even better would be to swap the elements without changing the HTML, just by changing the class with flex items :
developer.mozilla.org/en-US/docs/Web/CSS.../Ordering_flex_items
So the javascript would just have to change ( stackoverflow.com/questions/195951/how-c...lass-with-javascript ) the main productPrices class to, for example, productPricesReverse and then, you would do the swap with pure CSS.

stackoverflow.com/questions/3047755/i-am...button-in-javascript

Please Log in or Create an account to join the conversation.

  • Posts: 1
  • Thank you received: 1
  • Hikashop Business
1 year 3 months ago #354293

It would be nice as a new feature to made this a toggle for incl.tax or excl.tax possible.
Or maybe for B2B usergroup set excl.tax and for regular customers incl.tax (registered).

This looks a common use!

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.072 seconds
Powered by Kunena Forum