且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Magento获得购物车单件价格,含增值税.税

更新时间:2023-11-30 10:22:58

我没有找到确切问题的解决方案,但是我更改了设置以模仿此确切功能,而我遇到的问题不再存在.

I didn't find a solution to my exact problem, but I changed the settings to mimic this exact functionality, and the problem I encountered was no longer there.

首先,我删除了网站上的所有税金,并告诉magento所有价格均不含税(即使其中包括税金).

First of all, I removed all the taxes on the site, and told magento all the prices are excluding tax (even though they are including tax).

现在减税是通过对自定义组应用促销来实现的,因此

The tax reduction is now made through a promotion applied on a custom group, so for

$tax = 20; // percent 

我减少了

(1 - (1 / ($tax / 100 + 1)))*100 
// for 20% tax => 16.6667% reduction
// for 24% tax => 19.3548% reduction

带有4个小数(这是magento接受的数量).它可能会不时出现1美分的误差-因此,如果这不是问题,那就去解决吧!

with 4 decimals (that's as much as magento accepts). It may have an error of 1 cent from time to time - so if this is not an issue, go for it!

现在,整个网站上的价格都将准确显示该产品的价格(因为促销适用于每个购物车,而不是每个产品).

Now the prices all over the website will be shown exactly for the product (because the promotion is applied per cart, not per product).