Commit Graph

715 Commits

Author SHA1 Message Date
Rodrigo Primo a3f14c7256 Caches call to load product variation attributes
This commit adds product variation attributes to WP cache when they are first loaded to avoid running the same database queries when the same product is loaded multiple times. This cache will be invalidated whenever product attributes are changed.

Fixes #17120
2017-10-27 10:01:23 -02:00
Mike Jolley 08c4953b61 Clear counts cache when updating product attributes
Closes #17377
2017-10-26 20:16:52 +01:00
Rodrigo Primo fb70ae3fea Coding standards fixes 2017-10-25 17:53:17 -02:00
Claudiu Lodromanean a396a6c83e Merge pull request #17372 from woocommerce/fix/17369
Add cache invalidation for wc_get_product_terms
2017-10-25 10:30:44 -07:00
Mike Jolley a467d35acd Add cache invalidation for wc_get_product_terms
Closes #17369
2017-10-25 13:27:18 +01:00
claudiulodro e6a9a5f79b Fix date query meta unset checking 2017-10-24 13:07:21 -07:00
Mike Jolley 29e175901f Added an update_prices_from_children routine and fixed sync_prices 2017-10-17 10:06:49 -07:00
Claudio Sanches 368d958be4 Merge branch 'master' into feature/webhook-crud 2017-10-10 16:13:37 -03:00
Claudio Sanches c00fce3f94 Merge pull request #16490 from woocommerce/feature/16445
Webhooks CRUD and Data Store
2017-10-10 16:10:31 -03:00
claudiulodro 3723b95d7e Make parse_date_for_wp_query public 2017-09-26 12:03:11 -07:00
Mike Jolley 9c327f09db Sale logic only applies to simple products - fixes tests 2017-09-26 12:53:38 +01:00
Mike Jolley 4695d7a251 Handle sale dates on the fly in case of missed cron schedule.
Closes #16907
2017-09-25 14:19:20 +01:00
Joel Rowley 521bde2fba Bugfix: coupon object cache not being cleared upon deletion 2017-09-09 22:47:25 -04:00
Boro Sitnikovski 5224eab917 Update PR with new logic 2017-09-05 19:56:56 +02:00
Boro Sitnikovski 85e3cee634 Use prop getters/setters instead 2017-09-05 15:17:16 +02:00
Mike Jolley 2da895c68d Update price if product type changes
Fixes #16650
2017-08-30 16:23:57 +01:00
Mike Jolley c29b9acb5b Fix variable name
Closes #16636
2017-08-29 11:19:03 +01:00
Claudio Sanches c03520a661 Allow pre query filter return an empty array 2017-08-28 16:23:12 -03:00
Claudio Sanches d5aae55725 Prevent "Argument #N is not an array" warning when WP_User_Query returns null 2017-08-28 16:15:19 -03:00
Claudio Sanches f8c18ba899 Introduced pre query filter to WC_Customer_Data_Store::search_customers() 2017-08-28 16:14:13 -03:00
Josh Smith 49c7449e8b Merge remote-tracking branch 'upstream/master' 2017-08-23 22:41:04 +00:00
Mike Jolley 804feb9333 Store fee amount and prevent totals going negative 2017-08-23 12:15:06 +01:00
Josh Smith 39544cb27b [#12517] Remove calls to action woocommerce_process_product_file_download_paths since download ids should no longer change. They are now static UUIDs. 2017-08-23 03:22:33 +00:00
Josh Smith df64c48103 [#12517] In deprecated function call for update_download_id, use __METHOD__ instead of hard coded function name 2017-08-23 03:21:35 +00:00
Josh Smith ee13db49a2 [#12517] Move download log table to const and helper, output download log report titles in standalone function, reorganize download log data store read for code readability 2017-08-23 03:10:14 +00:00
Josh Smith 868a0e0e84 Merge remote-tracking branch 'upstream/master' 2017-08-23 02:33:01 +00:00
Claudio Sanches 03a189726e Introduces woocommerce_get_product_id_by_sku filter
Closes #16559
2017-08-22 15:04:21 -03:00
Mike Jolley fb2d8cb394 Prevent regular price being lower than the sale price
Closes #16560
2017-08-22 11:43:48 +01:00
Josh Smith 413444c616 Merge remote-tracking branch 'upstream/master' 2017-08-20 04:09:17 +00:00
Claudio Sanches 95de32d9c7 Changed webhook table name for #16390 2017-08-18 13:41:02 -03:00
Jeremy Pry 2d4b7356df Update some docblocks with proper parameters 2017-08-18 12:18:19 -04:00
Mike Jolley e99471c0cd Removed manual discounts code 2017-08-18 10:36:10 +01:00
Claudio Sanches 2a3d37cc89 Webhooks does not have meta data 2017-08-17 19:42:54 -03:00
Claudio Sanches 2d19d47357 Fixed spacing 2017-08-17 19:04:36 -03:00
Claudio Sanches 3266fd48fe Fixed how to auto set dates 2017-08-17 18:43:08 -03:00
Claudio Sanches 1829c81689 Fixed coding standards 2017-08-17 11:14:41 -03:00
Claudio Sanches 9fac34fbcb Save webhook results on wp cache 2017-08-17 11:07:30 -03:00
Claudio Sanches dcf3e27155 New helpers to load webhooks 2017-08-17 10:51:20 -03:00
Claudio Sanches 00185c5911 Webhook data store 2017-08-17 00:08:32 -03:00
claudiulodro ae80d12d80 Merge master 2017-08-14 11:12:09 -07:00
Mike Jolley 1545e46fd5 cache clearing 2017-08-11 16:17:13 +01:00
Mike Jolley 5587ff6874 Variation data store should remove product_type term on save
Closes #16409
2017-08-11 12:32:12 +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 f71dc64d35 Manual discounts and negative taxes 2017-08-09 18:53:10 +01:00
Mike Jolley f480c98d11 Data stores 2017-08-09 16:17:02 +01:00
Josh Smith d8b6b2042a Merge remote-tracking branch 'upstream/master' 2017-08-08 21:20:35 +00:00
Boro Sitnikovski 9022261f13 Fix cache issue.
From discussion with @mikejolley:

The class is not doing its job of invaliding cache after adding a line item.
At any point (action hook), a 3pd can call `get_items` and it will cache the items for that particular order so any subsequent calls to it will return bad data.
Unless you ADD items, `get_items` will return good data.
So adding items in this case is not invalidating, so that's the bug.

Relates to: https://github.com/woocommerce/woocommerce-bookings/issues/1310
2017-08-07 15:29:17 +02:00
Josh Smith 644ac674d7 [#12517] Replace download_id on customer download and product download with static UUID instead of filename based hash, to preserve download links, logs, and permissions across filename changes 2017-08-05 04:42:31 +00:00
Josh Smith dfeead42a5 [#12517] Add download log report to WC admin reports, with link from Order details Downloads section 2017-08-03 21:24:53 +00:00
claudiulodro 91f1d41842 Clarify logic 2017-08-01 13:21:23 -07:00
claudiulodro 5e8f957f3a Formatting 2017-08-01 12:52:12 -07:00
Josh Smith 3953fd081c [#12517] Get data for get_download_count from download log table 2017-07-31 03:44:11 +00:00
Josh Smith 399269a4f1 [#12517] Implement logging product downloads into new logging table 2017-07-30 22:38:17 +00:00
claudiulodro e1fad0d7eb Bring up to date with master 2017-07-28 14:27:19 -07:00
claudiulodro b5e5f035fb Clean up 2017-07-28 13:27:19 -07:00
claudiulodro e335724c50 Finalize product query 2017-07-28 11:59:44 -07:00
Mike Jolley f47bb39a06 Merge pull request #15479 from woocommerce/add/poc-no-managing-meta-directly
Proof of concept to error when internal meta props are accessed directly
2017-07-27 15:54:24 +01:00
claudiulodro ec6d11bd67 Just needs visibility support and cleanup 2017-07-25 10:01:24 -07:00
claudiulodro 689c5e7006 Better code 2017-07-25 08:36:01 -07:00
claudiulodro cdbead8961 Clean up and tests 2017-07-24 15:05:23 -07:00
Jaydeep Rami 46d3638089 Fix missing return statement (#16148)
* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement
2017-07-20 18:01:14 +01:00
Mike Jolley 3faa1c1ee9 Unset variable prices on read.
Closes #16145
2017-07-20 12:48:14 +01:00
Mike Jolley 8d277a263b Sort by order + zone ID as a fallback in shipping zones
Fixes #16170
2017-07-19 10:16:50 +01:00
jaydeeprami 55100562b3 Fix typo in '@oaram' to '@param' 2017-07-19 08:14:41 +05:30
Claudio Sanches 90691e881f Merge pull request #16140 from woocommerce/update/16136
Added `woocommerce_data_store_wp_{$this->meta_type}_read_meta` filter
2017-07-17 19:24:44 -03: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
Mike Jolley a2a34cf0be Added `woocommerce_data_store_wp_{$this->meta_type}_read_meta` filter
#16136
2017-07-17 10:34:44 +01:00
claudiulodro 8c8684b8aa Move meta query init above sku query 2017-07-14 10:10:37 -07:00
claudiulodro b04534bb85 Hook everything up to wc_product_query 2017-07-14 10:01:25 -07:00
claudiulodro f66198c37d Initial working wc_get_products 2017-07-14 09:50:20 -07:00
claudiulodro 753979ec49 WC_Product_Query 2017-07-12 13:58:39 -07:00
Mike Jolley 6421b2a0be Fix rtrim for non - separators 2017-07-12 15:17:48 +01:00
Daniel Rey Lopez 04a83b0faa Change the "Rest of the World" zone name to "Locations not covered by your other zones" everywhere 2017-07-11 08:19:42 +01:00
Akeda Bagus 53807185a8
Fixed typos.
These typos are catched by `misspell` program.

```
find . -type f | grep -v assets | grep -v dummy-data | grep -v i18n | grep -v node_modules | grep -v .git | grep -v apigen |  xargs misspell -w
```

Some results were excluded because of 3rd party ownership and non-english
sentences.
2017-07-10 12:56:28 +07:00
Mike Jolley b9757cca00 leave objects alone rather than slashing in the meta api
Has tests. Prevents notices when you pass an object to add_meta_data.
2017-07-04 16:09:21 +01:00
Mike Jolley 6bc1c16d77 Merge pull request #15900 from JustinSainton/patch-4
Add search_customers() filter
2017-07-04 10:54:50 +01:00
Justin Sainton 31d8a4a6d7 Add additional parenthesis.
Maybe don't throw fatal errors.
2017-07-03 10:19:57 -07:00
Mike Jolley 8ab1ef459c WP_Query expects paged, not page
Fixes #15930
2017-07-03 12:24:30 +01:00
Justin Sainton 29c9fa55d8 Add search_customers() filter
Includes each of the parameters passed to the method, as well as a context parameter for each query.

Our specific use case for this is for a custom wholesale ordering system, where we're wanting to limit the search to a specific role - so customizing the arguments here would be really helpful.

Ironically, proposed the same thing three years ago and the committed filter no longer exists: e91ca49b6d
2017-06-30 13:52:24 -07:00
Mike Jolley 3bfd2bab48 Prevent extra slashes on meta values
by_mid functions do not expect slashes

Fixes #15868
2017-06-29 22:41:11 +01:00
Claudio Sanches 70ae880f29 Merge pull request #15843 from woocommerce/fix/15834
Force date created on update if not set.
2017-06-28 11:11:40 -03:00
Mike Jolley 8dcbf9aa8d Force date created on update if not set.
Closes #15834
2017-06-28 12:25:23 +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
Mike Jolley d568069c37 Add slashes to meta value in data store before passing to WP functions
Fixes #15808
2017-06-27 15:11:32 +01:00
Claudiu Lodromanean 5ebc4a4010 Merge pull request #15740 from woocommerce/update/prime-term-caches
Update/prime term caches for product queries
2017-06-22 08:18:55 -07:00
Mike Jolley 67bc729ea5 update_post_caches for all posts at once 2017-06-22 13:39:17 +01:00
Mike Jolley 74cb2965b3 Ensure we have a parent
Fixes #15737
2017-06-22 12:06:10 +01:00
Mike Jolley e06aa6f60a Prime term cache before read 2017-06-21 17:09:39 +01:00
Mike Jolley 0ce2ff2249 Fix update of terms after new rating 2017-06-15 11:29:18 +01:00
claudiulodro 57c5bab731 Space 2017-06-14 09:58:15 -07:00
Mike Jolley cb34cb8d81 Made variations more lenient so that they can be created whilst a parent does not yet exist 2017-06-14 16:37:46 +01:00
claudiulodro 62064d56f8 Add edge case test 2017-06-13 14:00:12 -07:00
claudiulodro f1a9dbc69e Extra checks and tests 2017-06-13 13:32:21 -07:00
claudiulodro f020d54e67 Add support for paginate and return ids in wc_order_query 2017-06-12 13:26:29 -07:00
Mike Jolley 012f251e42 Update variation outofstock term on save. 2017-06-12 13:09:47 +01:00
Mike Jolley 6eacecfeb6 Append blog ID on persistent cart user meta 2017-06-08 13:47:23 +01:00
Boro Sitnikovski 0271a9e2fe Update version 2017-06-07 16:20:09 +02:00
Claudio Sanches 20d5e0f769 Merge pull request #15477 from woocommerce/fix/15392
Variations to inherit catalog_visibility
2017-06-06 14:27:46 -03:00
Boro Sitnikovski efd42e6bc4 Proof of concept to error when internal meta props are accessed directly 2017-06-06 19:13:53 +02:00
Mike Jolley e0a64ad36a Variations to inherit catalog_visibility 2017-06-06 14:49:32 +01:00
Claudio Sanches 6be1569955 Start indexing variations with 1, closes #15081 2017-06-05 17:42:58 -03:00
Mike Jolley fc4a9d185e Move changes after set name 2017-05-31 16:28:55 +01:00
Claudio Sanches bc3c7f6bbd Merge branch 'master' into fix/15315 2017-05-31 11:59:49 -03:00
Mike Jolley 6883b49e81 Atom sucks 2017-05-31 15:57:49 +01:00
Mike Jolley eda55579b7 Merge pull request #15373 from woocommerce/feature/product-csv-import-export
Product CSV Import Export
2017-05-31 13:57:37 +01:00
Mike Jolley 21300951f1 Fix tests due to generated names 2017-05-31 13:48:28 +01:00
Mike Jolley 32ab4fb47f Merge pull request #15360 from woocommerce/fix/15228
Store user ID and use that to determine if the session should be loaded or not.
2017-05-31 13:03:29 +01:00
Mike Jolley 532ddfa6b0 Merge conflicts 2017-05-31 12:23:52 +01: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
Mike Jolley 60def8cde0 Store user ID and use that to determine is session data should overwrite user data. 2017-05-30 17:03:55 +01:00
Mike Jolley 3dd7cbf59b Revert d570a81241 2017-05-30 16:54:37 +01:00
Cesar Rodas 001cf94ff3 Fixed typo 2017-05-30 10:37:29 -04:00
Mike Jolley ed32f9c792 Only delete if the object has an ID 2017-05-30 14:44:28 +01:00
Mike Jolley 2346af1816 Update title if changed
This could be the result of a term name changing, parent changing etc.

Fixes #15315

May degrade performance if reading many variations.
2017-05-30 13:20:36 +01:00
Mike Jolley f1d718d38a Format parent stock qty on read
Fixes #14759
2017-05-29 10:03:35 +01:00
Mike Jolley 2e5053633b CRUD should update post type on update so it matches expected value. 2017-05-25 12:09:59 +01:00
Kelly Dwan 0a265b53a2 Add display_name to customer data store 2017-05-24 13:57:11 -04:00
Mike Jolley f866f164eb Merge pull request #15244 from woocommerce/improvement/15187
Order query unit tests and fixes.
2017-05-24 12:03:40 +01:00
claudiulodro 201ea727db Simplify status check 2017-05-23 18:52:03 -07:00
claudiulodro 4faad7d964 Finish unit tests and bugfixes 2017-05-23 18:44:37 -07: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 383a318f59 Merge pull request #14949 from aelia-co/Improvement-customer-total-spent-filter
New filters for customer total spent
2017-05-23 20:37:58 +01:00
Diego Zanella 89efc65327 Fixed call to woocommerce_customer_get_total_spent_query filter
* Variable `$customer` was passed to `$wpdb->get_var()` instead of the filter.
2017-05-23 20:35:21 +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
Diego Zanella a6bcc73846 Added $customer to filter woocommerce_customer_get_total_spent_query 2017-05-23 17:06:16 +01:00
Diego Zanella 885cb14029 Merge branch 'master' into Improvement-customer-total-spent-filter 2017-05-23 17:05:08 +01:00
Mike Jolley 2383799409 A single multi-word attribute is fine for variation titles
Closes #15225
2017-05-23 10:52:44 +01:00
Mike Jolley fc8100877c Undo change 2017-05-22 12:19:54 +01:00
Mike Jolley 2082d84e4d Always sync incorrect titles on variation read regardless of version
For #15158
2017-05-19 11:28:13 +01:00
Mike Jolley eb147197a2 Variations should inherit purchase_note from parent.
Fixes #15115
2017-05-18 14:47:00 +01:00
Mike Jolley 351b0e0c67 Support limiting in search_customers 2017-05-16 10:16:57 +01:00
Rasmus Bengtsson 185934fad9 Fix phpdoc to include params and correct types 2017-05-15 13:50:52 +02:00
Rasmus Bengtsson 4a3902cd48 PHPDoc: Add missing throws statement 2017-05-15 13:39:03 +02:00
Rasmus Bengtsson 4f00d7e5e3 PHPDoc: Add missing return statement 2017-05-15 13:37:59 +02:00
Rasmus Bengtsson 6a7fc8650f Remove unused local variables 2017-05-15 12:06:52 +02:00
claudiulodro 9e9b9b86ba Cant use empty check in customer query var 2017-05-14 17:05:46 -07:00
claudiulodro cec2c3b7dc Couple requested changes 2017-05-13 12:22:22 -07:00
claudiulodro fe40e9b96a Make date queries work properly 2017-05-12 15:25:15 -07:00
claudiulodro 5b578c389f Use previous filter name 2017-05-12 13:14:52 -07:00
claudiulodro eee2ef82e8 Deprecate ->get_orders 2017-05-12 13:06:17 -07:00
Mike Jolley e777b4d557 Merge branch 'feature/product-csv-import-export' into feature/csv-exporter 2017-05-12 21:03:20 +01:00
claudiulodro 3861e32803 Migrate wc_get_orders 2017-05-12 11:45:01 -07:00
Claudiu Lodromanean c6fc0003c3 Merge pull request #14971 from woocommerce/improvement/13646
WC_*_Query date queries
2017-05-11 21:43:41 -07:00
Claudio Sanches 663c1d5f51 Merge pull request #15012 from woocommerce/fix/14994
Correctly set rating during updates
2017-05-10 19:08:38 -03:00
claudiulodro e31cbfd5c4 Formatting for readibility 2017-05-10 14:33:29 -07:00
Mike Jolley 4cacceeede Variation handling 2017-05-10 22:16:53 +01:00
claudiulodro d461ea86d6 Use local timezone for yyyy-mm-dd queries 2017-05-10 13:08:47 -07:00
claudiulodro db1d5ac987 Simplify logic 2017-05-10 12:02:15 -07:00
claudiulodro a0727fb8a1 Change to date array 2017-05-10 11:49:11 -07:00
Mike Jolley 37a544dd6f Ensure needle is set
Fixes #15004
2017-05-10 19:30:34 +01:00
Mike Jolley cd9119443a Correctly set rating during updates
Fixes #14994
2017-05-10 19:21:38 +01:00
claudiulodro 5d86b2f001 Formatting 2017-05-09 14:55:39 -07:00
claudiulodro 93835f69db New working date query format 2017-05-09 14:49:45 -07:00
claudiulodro c89e389b3f Good progress towards better date queries 2017-05-09 11:37:45 -07:00
Mike Jolley 19fb7ac079 Fix hardcoded table name 2017-05-09 19:17:24 +01:00
Diego Zanella 3f3f2bdc2c New filters for customer total spent
* Added new filters to allow altering the calculation of customer's total spent:
  * `woocommerce_customer_get_total_spent`
  * `woocommerce_customer_get_total_spent_query`
2017-05-08 19:39:13 +01:00
Mike Jolley a741f2c7bf Make other queries match the new query in 14936 2017-05-08 19:08:59 +01:00
Mike Jolley b961d6fb74 Correctly exclude terms in wc_get_related_products
Fixes #14909
2017-05-08 14:15:16 +01:00
Mike Jolley dd3be1278b Merge pull request #14733 from woocommerce/feature/13646
WC_Object_Query & WC_Order_Query
2017-05-07 14:24:12 +01:00
Claudio Sanches 421c9a3ba7 Introduced woocommerce_shop_order_search_results filter
Closes #14857
2017-05-03 18:14:41 -03:00
Claudio Sanches 63552c9757 Fixed conflict between global attributes and custom attributes.
Check if is a custom attribute before trying to get an ID from a global attribute.
2017-05-03 16:30:50 -03:00
claudiulodro 7c393a4469 Better time handling 2017-04-28 14:01:06 -07:00
claudiulodro 1bb46ad876 Array filter results 2017-04-28 10:12:31 -07:00
Mike Jolley af09548ec0 Add missing shipping_company from internal props in data store
Fixes #14768
2017-04-28 13:44:22 +01:00
claudiulodro 30d2332f48 Handle paginate 2017-04-27 19:14:48 -07:00
claudiulodro 0721354ff2 Add paginate 2017-04-27 15:02:02 -07:00
claudiulodro 11c7722eff Update tests 2017-04-27 14:46:00 -07:00
claudiulodro 059389c684 Missed a spot 2017-04-27 14:13:06 -07:00
claudiulodro 4eb1396e85 Offload more to subclasses 2017-04-27 14:09:10 -07:00
claudiulodro db3de7375d Tweaks from feedback 2017-04-27 11:07:03 -07:00
claudiulodro 6aecb15505 Reduce scope 2017-04-27 08:38:18 -07:00
claudiulodro 020e24225a Line up array 2017-04-26 14:20:44 -07:00
claudiulodro 1647e253a0 Add filters 2017-04-26 11:19:54 -07:00
claudiulodro 2fad12221d Better comments 2017-04-26 11:04:28 -07:00
claudiulodro 9f0f0cd246 Polish and cleanup 2017-04-26 10:49:19 -07:00
Mike Jolley 481a5045aa Merge pull request #14622 from jaumarar/patch-2
Fix: Creating customer triggers password changed
2017-04-26 14:32:28 +01:00
Mike Jolley 234bc3c017 Missing arg in data store too 2017-04-26 11:08:47 +01: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
claudiulodro efa1dbbda5 Basic working order queries 2017-04-25 14:52:17 -07:00
Mike Jolley 8e624e6230 Filter invalid products before returning them for wc_get_products
Closes #14592
2017-04-25 14:03:30 +01:00
Jaume 5e53ed70d8 Fix: Creating customer triggers password changed
Sending POST /wc/v1/customers or POST /wc/v2/customers with the required args triggers the 'Notice of Password Changed' after creating the customer due to update() calls when the password still has a value.
2017-04-22 20:06:56 +02:00
Mike Jolley a325d03deb wc_get_orders support for guest orders and unit tests
Fixes #14575
2017-04-20 18:05:58 +01:00
Claudio Sanches 0b60af0774 Merge pull request #14415 from woocommerce/fix/save-post-infinite-loops
Prevent infinite loops during save_post
2017-04-20 00:44:57 -03:00
Claudio Sanches c90e71e890 Merge pull request #14509 from woocommerce/fix/14480
Only return product by SKU if published
2017-04-19 14:38:14 -03:00
Claudio Sanches 0d46a89f83 Check only if is not in trash 2017-04-19 14:27:19 -03:00
Mike Jolley bdb01c4bea is_existing_sku should check all post statuses except for trash
Fixes #14525
2017-04-19 11:32:49 +01:00
Claudio Sanches f61646d1a2 Only return product by SKU if published
Fixes #14480
2017-04-18 21:32:52 -03:00
Mike Jolley d4a8f3c25b fix coupon update 2017-04-15 21:48:22 +01:00
Mike Jolley 1f28b9d0b8 Other object types 2017-04-15 21:18:24 +01:00
Mike Jolley 27c9006f77 Product data store loop protection 2017-04-15 21:04:41 +01:00
claudiulodro 96ed33f227 Use read_downloads in variations 2017-04-14 14:18:08 -07:00
Mike Jolley 21da0cf71f Ensure name and file is set 2017-04-12 14:11:04 +01:00
Claudio Sanches 627d7a8790 Merge pull request #14278 from woocommerce/fix/14209-alt
Variation Attribute Name Fixes (simplified)
2017-04-11 17:25:28 -03:00
Mike Jolley 5cfed7569c Simplify wc_is_attribute_in_product_name and change separator 2017-04-11 21:12:30 +01:00
Claudio Sanches 3278d9e5d7 Merge pull request #14255 from woocommerce/fix/14163
Download permissions; Convert dates to timestamp on read so UTC is preserved.
2017-04-11 16:51:20 -03:00
Mike Jolley 510adc652c Download permissions; Convert dates to timestamp on read so UTC is preserved.
Fixes #14163
2017-04-11 13:13:03 +01:00
Mike Jolley 899176bee7 woocommerce_update_customer_args filter 2017-04-11 12:47:53 +01:00
Claudiu Lodromanean 903b176b99 Attribute title tweaks 2017-04-10 13:16:58 -07:00
Mike Jolley 243b7a0d3f Exclude location meta from setters 2017-04-10 12:16:25 +01:00
Govind Kumar 2ea79cc5ed Fixed issue #14124 2017-04-07 19:14:10 +05:30
Claudio Sanches 708df27719 Merge pull request #14117 from woocommerce/fix/14108
If variation tax class meta is not set, it should be 'parent' to support 2.6 data
2017-04-07 13:29:40 -03:00
Mike Jolley 7418b9f8b8 If variation tax class meta is not set, it should be 'parent' to support 2.6 data
Fixes #14108
2017-04-07 17:13:59 +01:00
Claudio Sanches 51c00cce09 Merge pull request #14099 from dixitadusara/issue-14089B
Modified suggestion of Invalid argument supplied for foreach ref #14089
2017-04-07 12:33:01 -03:00
Mike Jolley 4f412678bd Ensure meta_value has valid keys in read_attributes
Fixes #14085
2017-04-07 10:59:59 +01:00
dixitadusara e527b6608c modified suggestion of Invalid argument supplied for foreach ref #14089 2017-04-07 15:27:52 +05:30
dixitadusara 3ba9063d3d Invalid argument supplied for foreach - class-wc-product-data-store-cpt.php ref #14089 2017-04-07 13:24:34 +05:30
Mike Jolley 1b5cad3d78 Fix variation category restriction and limit to x uses
Fixes #14068
2017-04-06 21:51:11 +01:00
Claudio Sanches 14572c8d80 Merge pull request #13991 from woocommerce/fix/13928
When setting props, exclude deprecated ones
2017-04-06 16:20:34 -03:00
Mike Jolley 2877752e1f array_flip 2017-04-06 20:18:14 +01:00
Claudio Sanches 0529e4efab Merge pull request #14026 from woocommerce/fix/13978
Fix variable stock syncing
2017-04-06 16:06:26 -03:00
Mike Jolley 8f2287be12 Use get_children for comparison 2017-04-06 19:47:22 +01:00
Mike Jolley 5701b1f7e2 Get cross sells from parent
fixes #14054
2017-04-06 19:01:57 +01:00
Claudio Sanches 42ca7bda3d Merge pull request #13989 from woocommerce/fix/product-meta-save_post
Fix saving meta when using `save_post`.
2017-04-06 14:38:16 -03:00
Mike Jolley fd3e656912 Pull tax status from parent since there is no UI to set at variation level 2017-04-06 17:54:34 +01:00
Claudio Sanches 9a219b71da Merge pull request #14036 from woocommerce/fix/14032
Make sure we have a prefix for strstr
2017-04-06 10:25:46 -03:00
Mike Jolley 822412d03c Make sure we have a prefix for strstr
Closes #14032
2017-04-06 14:11:00 +01:00
Mike Jolley a7a896008c Fix up the child_is_in_stock function 2017-04-06 12:26:19 +01:00
Mike Jolley d570a81241 Set session data only if the value is empty in customer object. Prevents session data overwriting customer data on login.
Fixes #13906
2017-04-06 10:28:32 +01:00
Mike Jolley 70778abade When setting props, exclude deprecated ones
Fixes #13928
2017-04-05 23:16:45 +01:00
Justin Shreve 15bf1da7d5 Call save_meta_data before wp_update_post for data stores that use it, and refresh meta cache after. 2017-04-05 14:39:41 -07:00
Claudiu Lodromanean c02cee595e Add missing download_id param 2017-04-05 13:37:42 -07:00
Mike Jolley 359213d720 Fix direction 2017-04-05 20:25:21 +01:00
Mike Jolley 0035afc5a0 Make sure we have number > 0 so all variations are not deleted 2017-04-05 20:22:05 +01:00
Claudio Sanches f250cac8d1 Merge pull request #13967 from woocommerce/fix/13933
Use parent settings for determining if variations are sold individually.
2017-04-05 15:33:17 -03:00
Claudiu Lodromanean 5389844a1b Use parent data for sold_individually 2017-04-05 11:02:26 -07:00
Mike Jolley 27b35c0515 Using WPDB is quicker than wp_update_post 2017-04-05 18:40:59 +01:00
Mike Jolley ab4c921bd1 Wrap in try catch so WC_Data_Exceptions are caught on bad email. 2017-04-05 16:36:28 +01:00
Mike Jolley 71ce5b85bc Merge pull request #13884 from woocommerce/fix-13875-13877
Private and variable product fixes
2017-04-03 19:16:35 +01:00
Mike Jolley 0a96f17747 Flip orderby 2017-04-03 12:12:13 +01:00
Mike Jolley 8598f82c8a If user can edit private products, search them
Fixes #13877
2017-04-03 12:04:59 +01:00
Mike Jolley 31cd2dcb90 Merge pull request #13853 from woocommerce/crud-security-hardening
CRUD security/hardening
2017-04-03 11:09:38 +01:00
Mike Jolley 999a597055 Escaping in search orders 2017-03-31 17:14:08 +01:00
Mike Jolley 8a201b64c5 Only set dates if set/not null
Fixes #13848
2017-03-31 12:38:18 +01:00
Mike Jolley 14802a0307 Remove double unserialization 2017-03-31 12:10:20 +01:00
Mike Jolley 12e28a83f3 WC_Product_Variable_Data_Store_CPT::read_variation_attributes() cast to int 2017-03-31 11:37:12 +01:00
Mike Jolley 0d1cfe6fd2 Use prepare on `type` in payment token data store 2017-03-31 11:22:47 +01:00
Mike Jolley f1a699c259 Cleanup 2017-03-31 11:18:22 +01:00
Mike Jolley a443419006 remove extract and sanitize orderby against whitelist 2017-03-31 11:15:55 +01:00
Mike Jolley 399c141377 Fix slug updating in CRUD
Fixes #13824
2017-03-29 13:41:23 +01:00
Claudio Sanches 1c369e41e0 Merge pull request #13810 from woocommerce/fix-typo
Fix typo
2017-03-28 15:22:45 -03:00
Claudiu Lodromanean 28726570bf Use new_* hooks instead of created_* 2017-03-28 11:05:45 -07:00
Akeda Bagus 0b416439c8
Fixed all typos of all files in includes/ directory.
Scanning and fixing were done automatically by codespell,
https://github.com/lucasdemarchi/codespell.
2017-03-29 00:58:51 +07:00
Mike Jolley 3c008b8a56 Check for null 2017-03-28 17:26:58 +01:00
Mike Jolley 9d9c9cdc9e Merge pull request #13772 from crodas/order_item_should_check_if_there_is_any_change
Do not update order items every time if nothing changed
2017-03-28 15:28:40 +01:00
Mike Jolley 29d6f69a87 Revert "Clear parent transients on variation save"
This reverts commit 0694312cc9.
2017-03-28 14:32:52 +01:00
Mike Jolley e575904fbf Revert "Clear parent transient on variation creation"
This reverts commit 5f573b8777.
2017-03-28 14:32:46 +01:00