Commit Graph

426 Commits

Author SHA1 Message Date
Mike Jolley be042ee8f3 Set to amount before calc 2017-08-23 12:24:33 +01:00
Mike Jolley 804feb9333 Store fee amount and prevent totals going negative 2017-08-23 12:15:06 +01:00
Mike Jolley e99471c0cd Removed manual discounts code 2017-08-18 10:36:10 +01:00
claudiulodro 9a47146716 Fix discounts rounding issues 2017-08-15 14:11:25 -07:00
Mike Jolley be11c1089f Fix tests 2017-08-14 16:03:50 +01:00
Mike Jolley 7ddfe0703b Store coupon item taxes 2017-08-14 15:57:51 +01:00
Mike Jolley b826d02f9b Split tax across items for discounts 2017-08-11 17:53:49 +01:00
Mike Jolley 3496e8dca4 Match order of cart discount 2017-08-11 16:16:09 +01:00
Mike Jolley 56726deb5a Fix recalculate_coupons 2017-08-11 13:52:40 +01:00
claudiulodro 28f0431c56 Coupon usage counts 2017-08-10 11:27:13 -07:00
claudiulodro f1e6fd53bd Prevent double coupons 2017-08-10 11:14:01 -07:00
Mike Jolley db87fc68b9 Fix refs 2017-08-10 16:33:21 +01:00
Mike Jolley 30c80c6ad5 Fix tax recalc 2017-08-10 16:22:17 +01:00
Mike Jolley 22d6c789ab herpa derpa 2017-08-10 15:57:34 +01:00
Mike Jolley e90fb6d54f fix discount apply and save 2017-08-10 15:33:01 +01:00
Mike Jolley cd8fb23884 Add ability to get local item rather than from DB 2017-08-10 14:38:02 +01:00
Mike Jolley e2599d83c8 Apply methods 2017-08-10 14:22:27 +01:00
Mike Jolley 3dc9f06f6a Remove fixed discounts correctly 2017-08-10 12:06:03 +01:00
Mike Jolley 06381f28bd Edit items rather than recreate 2017-08-10 11:38:09 +01:00
claudiulodro a416ebe09b It kind-of works. 2017-08-09 14:55:35 -07:00
Mike Jolley 5874fb8715 Type and sum fix 2017-08-09 19:11:02 +01:00
Mike Jolley c556facd41 Fix percent coupon and display 2017-08-09 19:02:10 +01:00
Mike Jolley f71dc64d35 Manual discounts and negative taxes 2017-08-09 18:53:10 +01:00
Mike Jolley 2def474421 Order calc 2017-08-09 16:19:10 +01:00
Mike Jolley e9c3ebebdc Merge branch 'master' into feature/discounts-class
# Conflicts:
#	includes/abstracts/abstract-wc-data.php
#	woocommerce.php
2017-08-08 15:49:59 +01:00
Mike Jolley 6af275da6e Only return tax classes if product is taxable.
Fixes #16241
2017-08-03 08:44:02 +02:00
Mike Jolley 306db69eaf Remove order subclass 2017-07-27 10:49:47 +01:00
Mike Jolley abdb325d83 Order items 2017-07-26 15:47:30 +01:00
Jaydeep Rami 3522857d23 Fix typo in WooCommerce plugin (#16135)
* Fixed typo

* Fixed more typo

* Fixed more typo

* Fix tyop

* Fix more typo

* Fix more typo

* Fix typo

* Fix typo

* Fix typo

* Fix typo datatime object

* Fix short name of compat

* Fix typo: update short name

* Fix typo "deactive" to "deactivate" and short BW - Compat

* Fix typo "Backwards compat"

* Fix typo 'parameters'

* Fix more typo 'pararmeters'

* Fix typo 'compund'

* FIx typo order

* Fix typo

* Fix typo 'incorrecly'

* Fix typo 'genarate'

* Fix typo 'reletive'

* Fix typo 'Handly'

* Fix typo 'rotatated'

* Fix typo

* Fix typo 'additonal'

* Fix typos
2017-07-17 11:10:52 +01:00
Brent Shepherd 1992d90d37 Revert "Merge pull request #14706 from crodas/make_get_item_consistent"
This reverts commit 56ffa3d2aa, reversing
changes made to 64a60de24f.
2017-06-27 22:28:23 -07:00
jgacuca567 4a9950b4c5 Changed their to there 2017-06-06 17:30:20 -04:00
Cesar Rodas c96c62f380 Improved how taxes are applied
If by default the taxes are based on the shipping address and the current order doesn't have any, it would use the billing address rather than using the Shopping base location.

It's basically what WooCommerce is [doing already in Javascript](https://github.com/woocommerce/woocommerce/blob/master/assets/js/admin/meta-boxes-order.js#L526-L575). This kind of checks should be done in the backend, never in the client side.
2017-06-01 15:51:55 -04:00
Mike Jolley 56ffa3d2aa Merge pull request #14706 from crodas/make_get_item_consistent
Make get item consistent
2017-05-31 11:10:09 +01:00
Cesar Rodas 8c67ae6a7a Make `get_item` to rely no `get_items` 2017-05-29 12:38:25 -04:00
Cesar Rodas 563aa887f7 Apply woocommerce_order_get_items filter to get_item 2017-05-24 17:30:14 -04:00
Cesar Rodas ea9c573f2c Improved WC_Order::get_item()
Do not load all items, just load the items with a given order_item_type.
2017-05-23 20:12:47 -04:00
Cesar Rodas b612bab38b Fixed coding styles 2017-05-23 19:18:31 -04:00
Mike Jolley 6dfdc86111 Merge branch 'pr/14678' 2017-05-23 19:16:37 +01:00
Mike Jolley 109e951de3 Renamed filters and actions 2017-05-23 19:16:30 +01:00
Mike Jolley c16acc6b51 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	assets/css/wc-setup-rtl.css
#	assets/css/wc-setup.css
2017-05-23 19:00:24 +01:00
Mike Jolley d3666738d8 Merge branch 'pr/15069' 2017-05-23 18:56:58 +01:00
Mike Jolley 00e5189a05 Merge pull request #15070 from rasmusbe/phpdoc-missing-return-throws
Phpdoc: Add missing return and throws
2017-05-23 18:50:58 +01:00
Mike Jolley dd798d219e Make calculate tax function clear taxes if disabled on recalculation
Fixes #15057
2017-05-15 14:55:39 +01:00
Rasmus Bengtsson 185934fad9 Fix phpdoc to include params and correct types 2017-05-15 13:50:52 +02:00
Rasmus Bengtsson 4f00d7e5e3 PHPDoc: Add missing return statement 2017-05-15 13:37:59 +02:00
Claudio Sanches 257594a67c Merge pull request #14945 from woocommerce/pr/14875
Pr/14875
2017-05-08 13:56:12 -03:00
Mike Jolley 03a69e1d44 Prepend new item keys with `$items_key` to make them unique.
Fixes #14875
2017-05-08 17:44:10 +01:00
Boro Sitnikovski f493afe718 intval -> floatval 2017-05-04 10:09:16 +02:00
Boro Sitnikovski 8f63211f1c Fix non numeric warning for orders. 2017-05-03 08:31:35 +02:00
Cesar Rodas 7f357b18ba Fixed typo
This expression had a typo from the refactoring
2017-04-26 03:21:10 -04:00
Cesar Rodas d3fd16617c Improved phpdoc 2017-04-26 02:57:00 -04:00
Cesar Rodas 38f379a7d7 Make get_item() consistent (like get_items())
Right now get_item() is loading an item from the database directly. It doesn't
take advantage of our cache and it doesn't check if the item is already loaded in memory.

There is also another bug (or feature?) that it will let you load any item, even if the item is not related to the current order. I believe this is a bug, if somebody really wants to load any item regardless of the order they should use `WC_Order_Factory::get_order_item`.

Another bug is that items loaded with get_item() are not related to the order object, therefore any calls to Order::save() won't persist the changes made to the item.

This commits makes sure the item returned by get_item is loaded similarly like get_items() does, taking advantage of the cache and the $items protected property (chances are the item is already in memory, ready to be used).

If a given item is not found false will be returned. If item exists but it is not related to the current object it will return false as well (If this behaviour is wanted, I can easily change it load the item anyways instead of returning false).
2017-04-26 02:54:14 -04:00
Petar Petrov fdb28218ea items_type_key filter and woocommerce_order_line_item_object fix 2017-04-25 18:07:40 +03:00
Mike Jolley 9923612832 Prevent orders being their own parent (!)
Closes #14660
2017-04-25 14:18:27 +01:00
Petar Petrov 2b3ec357ad fix-14302 2017-04-25 14:12:36 +03:00
Mike Jolley 4a6c87d1cc docblock 2017-04-20 16:03:40 +01:00
Mike Jolley 8e28af8b87 define get_user_id/get_user methods for bw compat
Closes #14543
2017-04-20 16:02:10 +01:00
Mike Jolley de016c6615 Fix call to is_compound method
Fixes #14484
2017-04-18 12:00:21 +01:00
Beka Rice d35621f166 Cast unmodified tax as float as well 2017-04-15 12:01:37 -04:00
Beka Rice 9de8589c9c Fix PHP 7.1 warnings when manually adding order items 2017-04-14 11:12:53 -04:00
Claudiu Lodromanean 19361127a9 Array filter before saving 2017-04-06 14:47:22 -07:00
Mike Jolley fbcb46b273 filter items which are false
https://wordpress.org/support/topic/call-to-a-member-function-is_type-cl
ass-wc-order-php-on-line-1305/
2017-04-06 22:15:42 +01:00
Mike Jolley d917856378 Validate status if object_read
#13891
2017-04-04 12:39:35 +01:00
Mike Jolley 7857fbe41f Cast values to float
Fixes #13752
2017-03-24 12:05:28 +00:00
JeroenSormani 373bdda4f8 Add required filters to allow custom order item types 2017-03-20 10:37:06 +01:00
Claudio Sanches 59c2849736 Changed version 2.7 to 3.0 2017-03-15 13:36:53 -03:00
Mike Jolley d55653a408 Merge branch 'master' into fix-13498
# Conflicts:
#	includes/class-wc-order.php
#	tests/unit-tests/crud/data.php
2017-03-15 15:52:40 +00:00
Mike Jolley 6848fad224 Merge branch 'timezone-poc' into fix-13498 2017-03-09 16:10:07 +00:00
Mike Jolley 9427eb048d Set default status in getter, not during contruct.
Prevents loops like in Prospress/woocommerce-subscriptions#1902
2017-03-09 13:45:33 +00:00
Mike Jolley c7dc8ae2b4 date_created and date_modified getters and setters 2017-03-08 16:51:10 +00:00
Michael Pretty 6150ee2fde Validate the parent order ID by calling wc_get_order() instead of get_post() 2017-03-08 08:02:18 -05:00
Mike Jolley e5ed116e33 Split total row methods to avoid calling total row filter twice
Fixes #13456
2017-03-06 13:44:52 +00:00
Mike Jolley 1a8737fdeb Standardize cache group names 2017-03-02 17:15:39 +00:00
Mike Jolley f5a36778fd Move refund/payment method code out of abstract 2017-02-27 17:06:09 +00:00
Mike Jolley c5697f2d59 Logic error with used id 2017-02-23 15:25:49 +00:00
Mike Jolley 134df2f4a0 Save existing rates rather than recreate all
Fixes #13264
2017-02-23 14:14:50 +00:00
Mike Jolley ded2accace Allow trash status to be set/returned rather than pending 2017-02-22 11:53:47 +00:00
Mike Jolley b37e4da43c Move legacy classes to correct dir 2017-02-16 16:39:56 +00:00
Claudiu Lodromanean dda98da4ad Merge pull request #13192 from woocommerce/deprecated-hooks
Deprecated hook handling
2017-02-15 08:40:16 -08:00
Boro Sitnikovski 5dd607023b Fix PHP notice when there are shipping taxes. 2017-02-15 15:17:04 +01:00
Mike Jolley e0d1cfc7b0 Actions 2017-02-14 19:23:57 +00:00
Mike Jolley 1a61f20785 Add actions to trigger legacy actions 2017-02-14 18:55:56 +00:00
Mike Jolley 7ff301e2ca Merge branch 'master' into crud-perf-tweaks
# Conflicts:
#	includes/data-stores/class-wc-order-item-data-store.php
2017-02-09 12:31:25 +00:00
Mike Jolley 3529d7cafd Cache items 2017-02-01 14:54:18 +01:00
Mike Jolley 31308403d4 Use variables to save values in item crud. 2017-02-01 10:53:53 +01:00
Brent Shepherd 7a7c0fbce6 Add WC_Abstract_Order::get_valid_statuses()
So that classes which extend WC_Abstract_Order can define custom statuses
specifically for their order type and have those used for validation in
WC_Abstract_Order::set_status() instead of only the order statuses defined
by wc_get_order_statuses().

For example, the subscription order type has a number of custom order statuses,
like 'wc-active' and 'wc-expired', which do not apply to orders but are valid
statuses for WC_Subscription objects, which extend WC_Abstract_Order.
2017-01-31 15:00:03 -08:00
Brent Shepherd 0e393da2cd Fix woocommerce_order_add_product deprecation msg 2017-01-26 16:58:47 -08:00
Brent Shepherd 5e77311384 Fix deprecated action messages
Don't end sentence with double .. and instead of "Replace with Use CRUD"
just say "Replace with CRUD"
2017-01-26 16:44:28 -08:00
Justin Shreve 474a307420 Introduce get_tax_class_slugs. 2017-01-25 13:38:13 -08:00
Justin Shreve e4937b898d Fix PHP 7.1 warnings/notices. 2017-01-04 10:45:45 -08:00
Manos Psychogyiopoulos 40bf6afc29 fix incorrect inline comments
Ref: 01aba1fd2b
2016-12-22 19:41:23 +02:00
Mike Jolley 03b581f72e Refunds API/get_data() missing ID
Fixes #12672
2016-12-22 14:52:37 +00:00
Mike Jolley 20680203bb Add actions for all object types 2016-12-19 17:09:52 +00:00
Mike Jolley 5ae62959d8 Notices 2016-12-19 11:59:10 +00:00
Manos Psychogyiopoulos 87bb9adf08 use CRUD to add line item meta 2016-12-19 13:27:32 +02:00
Manos Psychogyiopoulos 3a8eae195b maintain order item meta action hooks 2016-12-18 18:13:11 +02:00
Mike Jolley d7dfdd3d10 Wrap all deprecation calls. 2016-11-23 16:15:00 +00:00
Mike Jolley 2b1c762142 Set parent 2016-11-23 15:37:34 +00:00
Justin Shreve dd0a2317f1 Fix up data tests and some coding standards issues 2016-11-22 04:05:05 -08:00
Justin Shreve 174aa38be6 Start moving meta to normal stores, instead of a separate meta store. 2016-11-22 04:05:05 -08:00