Closed extrapixel closed 9 years ago
should fix #17
How this looks like on the admin page?
no changes on the admin page... just tried to change some discounts. seems to work as expected.
People saying that doesn't works with taxes yet https://wordpress.org/support/topic/calculation-of-discount-on-wrong-basis?replies=17#post-7084692
I tested it extensively, using all possible tax combinations (enter prices with/without tax, show prices inclusive/exclusive in checkout, and all tax-display options). It just works. I can not replicate the issue she has. I suspect she's using an old (pre 2.3) version of woocommerce. As far as i know they revamped the tax system since then. unfortunately she won't answer in the forum thread so.... not much i can do for now.
...or there's a conflict with one of these "german market" and "germanized" plugins she's obviously using.
Turned out it's actually an incompatibility with the plugin "German Market". Other than that, my fix makes the discounts actually work with taxes. Without this fix the calculation is wrong (and illegal in most VAT countries, to be precise)
thanks :) This was being a headache for a long time.
you're welcome :) thanks for the plugin
you might want to contact the makers of "German Market" plugin to figure out where the incompatibility happens. And/or mention the incompatibility it on the plugin page - just to be fair.
Oh and (not sure, I think this was not working before) because we're in the woocommerce "fee system" now, everything working with fees should pick up the discount. For example PDF-Invoice / Packagin Slip plugins do now correctly work with discounts.
Thanks man :) I put this in the readme.txt and fixed some another issues with the discount HTML on the payment method title on admin. I now believe that we will not have many problems.
Using the built-in woocommerce fee system to add the discounts by adding a negative fee. This gives rendering and proper tax handling “for free”. Removed obsolete functions update_order_data & discount_display. Hooking woocommerce_cart_calculate_fees to add the discount.
Probably a bit hacky... but it works more stable regarding taxes for sure.