Developer forum

Forum » Dynamicweb 10 » Display prices including VAT for logged out customers only (or specific customer groups)

Display prices including VAT for logged out customers only (or specific customer groups)

Jon Thorne
Jon Thorne
Reply

What would be the best approach to only show VAT to logged out customers, or more specifically cusotmers from a specific group if possible. Use case is for B2C customers we want to display VAT, but not for B2B customers.

There is a website Area setting "Prices VAT" that enables and disables this for all users.

The only way I can see to change this would be to update all the templates that use this setting.

Are there any other options?


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Jon

You can switch between showing prices with or without vat using "PricesWithVAT=true|false" in a querystring.

When you have a price object, a priceviewmodel, you have 3 properties - priceWithVat, PriceWithoutVat  and finally .Price (consider it display price, depending on the PricesWithVAT setting is true or false returns one of the other prices with or without VAT)- see https://doc.dynamicweb.dev/api/Dynamicweb.Ecommerce.ProductCatalog.PriceViewModel.html

Using the querystring variable and some template logic or even a user choice, you can switch between showing prices with or without vat.

Alternatively you can also set that setting using the Context: Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat = true.

 

You must be logged in to post in the forum