claudiosanches / woocommerce-payment-discounts

Adds discounts for specific payment methods in WooCommerce.
http://wordpress.org/extend/plugins/woocommerce-payment-discounts/
31 stars 10 forks source link

fix tax bugs #18

Closed extrapixel closed 9 years ago

extrapixel commented 9 years ago

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.

extrapixel commented 9 years ago

should fix #17

claudiosanches commented 9 years ago

How this looks like on the admin page?

extrapixel commented 9 years ago

no changes on the admin page... just tried to change some discounts. seems to work as expected.

claudiosanches commented 9 years ago

People saying that doesn't works with taxes yet https://wordpress.org/support/topic/calculation-of-discount-on-wrong-basis?replies=17#post-7084692

extrapixel commented 9 years ago

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.

extrapixel commented 9 years ago

...or there's a conflict with one of these "german market" and "germanized" plugins she's obviously using.

extrapixel commented 9 years ago

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)

claudiosanches commented 9 years ago

thanks :) This was being a headache for a long time.

extrapixel commented 9 years ago

you're welcome :) thanks for the plugin

extrapixel commented 9 years ago

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.

claudiosanches commented 9 years ago

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.