VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: marvays on June 23, 2020, 18:17:43 PM

Title: Change price for all product
Post by: marvays on June 23, 2020, 18:17:43 PM
Hi.
I have eshop. I have vat 27%
Now, i need make copy all site, and locate into another country. On new copy i need change vat into 20%, but I need the price with VAT to remain the same.
Can I change all product prices via the database at once? I need to do "price * 1.27 / 1.2". Then I can change the VAT rate to 20% and the resulting prices will remain de facto unchanged.

Can anyone write me a sql command?
Title: Re: Change price for all product
Post by: AH on June 24, 2020, 09:23:26 AM
Yes you can - and I will ignore the very dubious practice of using a decrease in VAT to increase gross pricing :-)

You can do this with a direct database table update using SQL

You will also need to only apply to items that are subject to VAT (the update below DOES NOT DO THAT!)



update YOURTABLEPREFIX_virtuemart_product_prices as c

# NOW SET SOMETHING set p.product_price = round(p.product_price,2)

SET c.product_price = round(c.product_price * YOURCALC,2)


Take a table copy first :-)
Title: Re: Change price for all product
Post by: marvays on June 24, 2020, 09:24:19 AM
Thx
Title: Re: Change price for all product
Post by: AH on June 24, 2020, 09:27:03 AM
See my adjustment above as you will need to only apply to items that are subject to VAT