Claudio Sanches
d48f1d4e2e
Fixed package tag usage
2020-08-05 13:36:24 -03:00
vedanshujain
57c105a3fe
Remove wc_round_tax_total calls because lines would have already been rounded appropriately before reaching here.
2020-07-24 19:12:24 +05:30
Daniel Morell
94e317f9f8
Fixed wc_get_order function name
...
The WC_Abstract_Order __construct() method doc block had the wc_get_order() method referred to as get_order().
2020-06-17 10:49:40 -05:00
vedanshujain
3dc7df7af9
Use common code and round in subtotal.
...
We round in `get_subtotal` because its a front-end method. If more precision is required then `get_cart_subtotal_for_order` needs to be called. Also use same `get_cart_subtotal_for_order` method here as well for consistency.
2020-05-27 23:48:47 +05:30
vedanshujain
57d336433a
Fix regression caused by merging #25092 conflicting with #24828
2020-05-22 22:08:42 +05:30
Nestor Soriano
0eed82b3b7
Fix code standards violations introduced in #25092
2020-04-07 12:28:30 +02:00
Vedanshu Jain
237463c39b
Merge pull request #25800 from woocommerce/fix/25748
...
Fixes tax rounding issues
2020-04-07 00:24:34 +05:30
Néstor Soriano
13765d9e91
Merge pull request #25092 from leanzafrancesco/fix/25091
...
Fix/25091 - Wrong totals in orders with taxable and non-taxable products and percentage coupons
2020-04-06 12:31:07 +02:00
Rodrigo Primo
e40ddc5291
Merge pull request #25727 from leanzafrancesco/add/order-tax-location-filter
...
Add woocommerce_order_get_tax_location filter
2020-03-05 13:48:40 -03:00
vedanshujain
a0c209193b
Remove rounding because individual lines would already have been rounded at this point if needed.
2020-03-02 15:19:16 +05:30
vedanshujain
740e2c8a92
Treat individual tax totals as line items because they will be totalled later.
...
This means that we won't round them individually unless we have setting for round at line item enabled.
2020-03-02 15:19:16 +05:30
vedanshujain
48e63adf77
Make rounding methods consistent in orders and cart
2020-03-02 15:19:16 +05:30
Peter Fabian
150c77ba29
Improve coupon name output handling.
2020-02-26 12:24:04 +01:00
Francesco Leanza
5dfb618ff9
Add woocommerce_order_get_tax_location filter
2020-02-21 11:45:06 +01:00
Peter Fabian
147266f44f
Updates to reflect PR feedback.
2020-02-04 21:43:29 +01:00
Peter Fabian
248e69960b
Merge branch 'master' into update/order-detail-summary
2020-01-30 17:41:32 +01:00
Peter Fabian
ec8d477b09
PHPCS fix.
2020-01-30 17:09:33 +01:00
David Levin
d25178b793
rename fee method again
2019-12-18 22:19:34 -08:00
Matt Harvey
4326e39250
Leave other fee total logic alone, reduce the fee array to get a simple sum
2019-12-18 22:08:39 -08:00
Matt Harvey
4eeec4705d
Abstract fee calculation and expose as method to abstract Object class.
2019-12-18 20:58:39 -08:00
vedanshujain
72545c44b7
Add support for `_held_for_checkout` records to improve performance.
...
This will also improve transactional stability and avoid race conditions by providing a way to lock usage counts.
2019-12-17 19:13:19 +05:30
Francesco Leanza
59af851069
Merge branch 'master' into fix/25091
2019-12-09 16:46:02 +01:00
vedanshujain
aaa85ac74c
Use standard way to calculate total in `get_subtotal_to_display` for consistency.
...
We were calculating subtotal to display slightly differently then we would have calculated subtotal in the cart. This was affecting subtotal value in invoices and in order confirmation screen.
This patch updates how we calculate subtotal to display such that we calculate in same way.
2019-11-27 04:43:23 +05:30
vedanshujain
1de30e8963
Refactor so that trait don't have class specific functions.
2019-11-26 01:30:45 +05:30
vedanshujain
60cd7b3651
Refactor Order Class to use shared calculation logic.
...
We added a trait to move shared logic betweem Orders and Cart. This commit refactors Order class to use that shared logic.
Also adds a test for a failing case.
2019-11-25 17:53:14 +05:30
vedanshujain
bee7ea4490
Add trait which contains common total calc logic.
...
`WC_Abstract_Order` and `WC_Cart_Totals` have their own logic to calculate totals. This means that we would have to fix in two places. This commit adds a trait which can be used to place shared logic between above two classes.
2019-11-25 17:53:14 +05:30
Francesco Leanza
dd3427958b
Fixed order totals calculation if it contains taxable and non-taxable products and percentage coupons
...
Added PHPUnit tests
2019-11-21 11:28:22 +01:00
Vedanshu Jain
9641963001
Merge pull request #24740 from woocommerce/feature/24654
...
Make WC_Abstract_Order::recalculate_coupons() public
2019-10-02 15:56:36 +05:30
Claudio Sanches
8c88cd9b6f
Make WC_Abstract_Order::recalculate_coupons() public
2019-10-01 17:19:33 -03:00
vedanshujain
6f2d64dcb4
Check for max discount to be -ve to prevent overwriting fee.
...
When we refund fee and some other line item whose value is more than fee in a single requst, value of line item will overwrite refund fee.
This is because where we check to make sure that we do not discount more than total possible value (to prevent negative total), we do not account for the fact that sometimes the cart could contain refund items. In those cases max_discount * -1 will always be larges then fees total.
This commit adds a check to make sure that max discount * -1 is indeed negative before overwriting fee total.
2019-09-03 20:45:33 +05:30
Claudio Sanches
01f5a09d27
Merge pull request #23338 from woocommerce/update/23335
...
More useful actions in during CRUD save events
2019-07-08 18:56:14 -03:00
Jared Burke
332c94c13a
Fix fatal error when applying a virtual coupon to an order placed by a guest
2019-06-06 15:37:08 -05:00
Ajay Ghaghretiya
c9bcce3a31
#23850 Fixed the coupon usage limit issue when apply coupon from admin panel ( #23851 )
...
* fix the coupon usage limit issue
* fix the if condition for the usage limit
* fixed coding standard
* fix the if conditions for coupon usage limit per user
2019-06-03 10:47:32 -03:00
Gerhard Potgieter
b2ed079520
Manual orders coupon usage limits by email ( #23775 )
...
* Add functionality to wp-admin order to check for coupon usage based on email addresses, similar to how WC_Cart handles this seperately, included unit tests.
* Only do the coupon by email usage check if order is from a guest. Fix issue with unit test.
2019-05-27 11:45:29 -03:00
Claudio Sanches
28d49031d3
Merge pull request #23695 from james-allan/calc-base-zip-city
...
Calculate base store taxes including the store's zip and city
2019-05-22 20:49:57 -03:00
Boris Djemrovski
c45e06a130
get_formatted_line_subtotal takes Item object instead of an array
2019-05-16 12:04:34 +02:00
Gerhard Potgieter
30ce9ff6a3
Merge pull request #23689 from woocommerce/add/get_used_coupon_codes
...
Deprecate get_used_coupons in favor of get_coupon_codes
2019-05-15 15:34:40 +02:00
James Allan
6069854d9f
Replace wc_get_base_location() with individual getters
2019-05-15 15:43:15 +10:00
Gerhard Potgieter
b7facc0674
Merge pull request #23663 from danielbitzer/add_get_coupons_method
...
Add WC_Abstract_Order::get_coupons()
2019-05-14 11:35:21 +02:00
Gerhard
efe3e4c5d6
Move get_used_coupons to WC_Abstract_Legacy_Order and renamed get_used_coupon_codes to get_coupon_codes.
2019-05-14 11:19:48 +02:00
Daniel Bitzer
0705730121
Add WC_Abstract_Order::get_coupons()
2019-05-14 15:46:48 +09:30
James Allan
45b461639e
Calculate base store taxes including the store's zip and city
2019-05-14 13:43:57 +10:00
Gerhard
31acfbcb4a
Deprecate WC_Abstract_Order::get_used_coupons in favor of WC_Abstract_Order::get_used_coupon_codes, this reflects the actual data being returned better.
2019-05-13 14:40:54 +02:00
Nathan Dawson
6088f7c353
Fixes #23578 - Check taxes are enabled before adding totals row to orders
2019-05-01 22:05:46 +01:00
Mike Jolley
47eee0143f
Restore order note on exception
2019-04-17 13:07:52 +01:00
Mike Jolley
a0d4f6174c
Consistent CRUD classes with before/after save hooks
2019-04-17 12:47:35 +01:00
Mike Jolley
9529d6eee7
Use total, not amount, when calculating fees
2019-02-20 16:22:20 +00:00
Mike Jolley
b8921f9fba
Merge pull request #22420 from woocommerce/refactor/tax-rounding-methods
...
Refactor tax rounding methods for consistency
2019-02-12 16:13:58 +00:00
Ron Rennick
3f24ad8d4c
phpcs sniff fixes for abstract-wc-order.php
2019-01-27 11:38:08 -04:00
Ron Rennick
d32f189f27
recalculate coupons after adding to order
2019-01-26 23:57:32 -04:00