Magento get cart single item price incl. tax

前端 未结 6 2171
傲寒
傲寒 2021-02-14 15:45

I have a pretty weird issue, I hope someone can help me with this.

Here are the major config settings that influence my problem:

  • Catalog prices in admin pa
6条回答
  •  有刺的猬
    2021-02-14 15:55

    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.

    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 
    

    I add a reduction of

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

    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).

提交回复
热议问题