Commit Graph

1009 Commits

Author SHA1 Message Date
Claudio Sanches 78e382e4d6 Fixed incorrect concatenation of variation sale prices with ".00" 2019-12-06 12:37:23 -03:00
James Collins 0246b02a94 Merge branch 'master' into webhook-delete-cache 2019-12-06 08:57:54 +08:00
Rodrigo Primo 27915dd696 Exception when WC_Product_Variation is instantiated with the wrong type
This commits changes WC_Product_Variation to raise an exception when the
class is instantiated with an ID that belongs to a post object that is
not a product variation.

This is necessary to avoid problems like the one described in #24956
where passing a variable product ID to WC_Product_Variation would result
in transparently modifying the variable product title and excerpt.
2019-12-05 15:45:48 -03:00
Rodrigo Primo 61a843679a Fix WPCS violations automatically using phpcbf 2019-12-05 15:45:12 -03:00
Claudio Sanches 5fdb880831
Merge branch 'master' into feature/24956 2019-12-04 16:18:39 -03:00
Claudio Sanches 8033d5751e Changed wc_get_product_classname function name to wc_get_product_object 2019-12-04 16:15:16 -03:00
Claudio Sanches a12c25862b
Revert "Add support for '_held_for_checkout` records to prevent race conditions." 2019-12-04 16:03:05 -03:00
James Collins b29f8cc1bd Deleted cached webhook data when deleting a webhook 2019-12-04 12:04:35 +08:00
Claudio Sanches 258066dc2b
Merge pull request #25077 from woocommerce/update/coupon-object-update-hook
Fix second param of action hook woocommerce_coupon_object_updated_props
2019-12-03 17:53:04 -03:00
Claudio Sanches 0c486785ad
Merge pull request #25089 from woocommerce/fix/24009
Add support for '_held_for_checkout` records to prevent race conditions.
2019-12-03 17:47:22 -03:00
Claudio Sanches 988b72e461 Updated filter name to woocommerce_hold_stock_for_checkout
Also fixed coding standards
2019-12-03 16:38:17 -03:00
Peter Fabian 309c48ab0e Deprecated old cache function and replaced it with a new one. 2019-11-28 14:03:57 +01:00
vedanshujain e87024bb81 Add support for '_held_for_checkout` records to prevent race conditions.
When creating an order, if manage inventory is enabled then add a `_held_for_checkout` record with a expiry timestamp embedded. This is added in an atomic manner along with making a check whether we have current stock or not.
This record is removed when order status goes to either `processing` or `completed`.
2019-11-21 01:21:08 +05:30
Gerhard 2a4a1a5842 Remove unused $updated_props variable 2019-11-20 14:47:44 +02:00
Michael Weichselgartner 2092da00c4 Fix second param of action hook woocommerce_coupon_object_updated_props
Changed second param from $updated_props to $this->updated_props
2019-11-20 14:42:09 +02:00
Claudio Sanches ba0773d12e Apply wc_get_product_classname() in the current code base 2019-11-13 15:30:09 -03:00
Peter Fabian 3cbea2a902 Simplify 'any-check' to only include empty string. 2019-10-02 16:58:45 +02:00
Peter Fabian 4cfe22eef9 Made the attribute value comparison strict. 2019-10-02 16:05:44 +02:00
Peter Fabian 258e49a8de Allow attribute value 0 to work correctly with variations (especially add to cart and select variation). 2019-10-02 14:58:40 +02:00
Vedanshu Jain 7081c64115
Merge pull request #24294 from woocommerce/fix/24106
Make WC_Product_Query capable to sort products by "include" order
2019-10-02 18:02:06 +05:30
Rodrigo Primo b033c110db
Merge pull request #24229 from rynaldos/woocommerce_update_product_stock_query-changes
Use $new_stock in woocommerce_update_product_stock_query
2019-09-24 18:01:10 -03:00
Rodrigo Primo c3262eea3e
Merge pull request #24385 from woocommerce/fix/24356
Ensure WC_Product_Data_Store_CPT::is_existing_sku() return boolean
2019-08-21 16:52:13 -03:00
Gerhard 5a1615a152 PHPCS fix 2019-08-12 20:26:34 +02:00
Rodrigo Primo f687412acd
Merge pull request #24353 from woocommerce/fix/24334
Avoid PHP notice when getting order item type
2019-08-12 14:11:41 -03:00
Claudio Sanches 66dbb44100 Ensure WC_Product_Data_Store_CPT::is_existing_sku() return boolean 2019-08-12 12:45:43 -03:00
Rodrigo Primo 6c263c97b6
Merge pull request #24239 from Chouby/fix/delete_variations_actions
Fire related actions when deleting all product variations
2019-08-08 16:47:39 -03:00
Rodrigo Primo 21418bb28b Avoid PHP notice when getting order item type
This commit changes WC_Order_Item_Data_Store::get_order_item_type() to
avoid a PHP notice ("Notice: Trying to get property 'order_item_type' of
non-object") when there is no entry in the database for the order item
ID passed.
2019-08-07 18:03:26 -03:00
Mahdi Yousefi 449a258781
Remove whitespace at end of line 2019-08-07 11:26:28 +04:30
Mahdi Yousefi c2d05b1fc0
Update class-wc-shipping-zone-data-store.php 2019-08-07 08:34:14 +04:30
Claudio Sanches d624bb57d5 Fixed coding standards 2019-08-01 15:56:02 -03:00
Claudio Sanches decea3d28c Allow sort products by "include" order 2019-08-01 15:55:32 -03:00
Frédéric Demarle 0fa582a25f Coding standards 2019-07-26 13:40:13 +02:00
Frédéric Demarle e3dd09d021 Fire related actions when deleting all product variations 2019-07-26 11:55:30 +02:00
rspublishing bb2c929fba Use in woocommerce_update_product_stock_query 2019-07-25 09:31:37 +02:00
MahdiY 040a617cd1 Add filter hook to get zone criteria 2019-07-19 09:35:04 +04:30
Gerhard Potgieter 60b385ea93
Merge pull request #23268 from Spreeuw/patch-8
store tax rate percent in tax line items
2019-07-14 18:42:10 +02:00
Claudio Sanches 60c18ce544
Merge pull request #23067 from woocommerce/pr/23043
Allow matching of "any" attributes in find_matching_product_variation…
2019-07-12 12:40:53 -03:00
Ewout Fernhout 6fe857f718 Merge remote-tracking branch 'origin/master' into patch-8 2019-07-11 14:44:39 +02:00
Gerhard Potgieter 2734b190c1
Merge pull request #23881 from ionutcalara/master
Update find matching variation method inner query
2019-07-10 15:53:30 +02:00
Claudio Sanches 32996d2fdd Merge branch 'master' into pr/23043 2019-07-09 12:39:40 -03:00
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
oscargare 2c8e45830a Added new action "woocommerce_product_read" (#23181)
* Added new action "woocommerce_read_product_data"

* Added new action woocommerce_product_read
2019-07-04 14:17:34 -03:00
Claudio Sanches 1f73c63a57
Merge pull request #23909 from woocommerce/fix/23895
Explicitly check 0 value attributes when looking up variations.
2019-06-24 12:35:39 -03:00
Claudio Sanches 3ce6acec74 Updated outdated codex URLs 2019-06-12 19:31:01 -03:00
Gerhard 3894d156e6 Explicitly check 0 value attributes when looking up variations. 2019-06-12 11:27:27 +02:00
Ionut Calara 26dfe11493 Update find matching variation method inner query
Fix variation query to prevent the order by being ignored in some mysql
and mariadb versions. The order by has been moved outside and a left
join was added.
2019-06-07 13:05:01 +03:00
Claudio Sanches b5da70c74a Introduced woocommerce_search_products_post_statuses filter 2019-05-28 21:05:26 -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
Gerhard Potgieter 9f0e1a6e64
Merge pull request #23534 from woocommerce/fix/233880-alt
Revise update stock logic
2019-05-16 14:15:13 +02:00
Gerhard Potgieter d8f145c2ca
Merge pull request #23714 from woocommerce/fix/23692
Add back backward compatibility for coupon expiry_date meta field
2019-05-16 14:10:03 +02:00
Peter Fabian 207042f7df Put back the manage stock check for lookup table. 2019-05-16 10:57:42 +02:00
Peter Fabian 9f0fb0b404 Foxed the use to correct stock quantity parameter. 2019-05-15 16:18:24 +02:00
Peter Fabian af7950910c Removed the transaction and locking code.
NOWAIT is not supported on MySQL server 5.5,

SELECT ... FOR UPDATE can leave lingering locks on InnoDB ("When InnoDB performs a complete rollback of a transaction, all locks set by the transaction are released. However, if just a single SQL statement is rolled back as a result of an error, some of the locks set by the statement may be preserved. This happens because InnoDB stores row locks in a format such that it cannot know afterward which lock was set by which statement.", via https://dev.mysql.com/doc/refman/5.5/en/innodb-deadlock-detection.html)
2019-05-15 15:09:16 +02:00
Peter Fabian 68a325249f Removed the extra parameter that didn't make sense.
Also get_data_for_lookup_table should not be checking db value of  _manage_stock as that can be in the process of being changed.
2019-05-15 14:20:27 +02:00
Gerhard aadc7a1069 Add todo 2019-05-15 11:23:41 +02:00
Gerhard 8ed1a647bc Restore backward compatibility meta_key for coupon date_expires. @todo: migrate expiry_date in next release to date_expires 2019-05-15 11:21:52 +02:00
Gerhard 3d57a4b474 Use WC_Cache_Helper::get_cache_prefix for prefixing webhook count cache, fixes issue with cache not clearing when incrementing the prefix. 2019-05-15 10:47:50 +02:00
Peter Fabian 375880e06b Made the increase and decrease operations atomic, set is atomic as it's not fetch-and-update, just update. 2019-05-02 19:41:15 +02:00
Peter Fabian 44f1803c53 Tweaked update lookup table to add the possibility to ignore manage_stock value from the database.
E.g. if manage_stock property has been changed in the object/local copy of the product while updating it, but the product has not been saved to the db yet, the lookup table update would ignore stock quantity update.
2019-05-02 19:29:28 +02:00
Mike Jolley 0cd5c1da66 Allow stock to be force read without a change 2019-04-26 17:24:11 +01:00
Mike Jolley ae7436d37c Select for update, returning the new stock value 2019-04-26 17:23:45 +01:00
Mike Jolley 57929f2b09 During initial lookup generation set option 2019-04-23 15:23:47 +01:00
Mike Jolley 867f6ce7ad
Merge pull request #23418 from szepeviktor/patch-2
Refunds are WC_Order_Refund
2019-04-23 12:24:20 +01:00
Viktor Szépe b1476ba497
Fix coding style
in class-wc-order-refund-data-store-cpt.php
2019-04-22 23:05:34 +02:00
Viktor Szépe babb5ab18e
Refunds are WC_Order_Refund
props. @phpstan
2019-04-21 21:55:13 +02:00
Mike Jolley f306d3fc11
Merge pull request #23266 from woocommerce/fix/23234
Switch to subquery for sale product query
2019-04-18 12:36:22 +01:00
Mike Jolley e354bb90aa Pass objects to new/update actions 2019-04-17 12:50:46 +01:00
Timmy Crawford e12e4aaa25
Merge pull request #23304 from woocommerce/fix/link-all-variations
[3.6] Fix logic in link all variations
2019-04-15 11:16:22 -07:00
Mike Jolley 30129f00ff Fix issue in tests by disabling strict mode 2019-04-15 12:10:22 +01:00
Mike Jolley d0c6c54989 Moved link/create code to data store with new unit test
This code was not testable within ajax code, so moved to the data stores.
2019-04-15 11:59:57 +01:00
Ewout Fernhout 794ba844b2 store tax rate percent in tax items 2019-04-10 17:35:43 +02:00
Mike Jolley fe385c9f74 fix query by adding alias 2019-04-10 13:48:03 +01:00
Mike Jolley 2e24cc7b0c Switch to subquery for sale product query 2019-04-10 12:43:22 +01:00
Manos Psychogyiopoulos 861d42f368 Fix IN type 2019-04-09 05:48:08 +03:00
Manos Psychogyiopoulos f6c560d684 Introduce IN and NOT IN clauses in `WC_Product_Data_Store_CPT::search_products`
closes #23245
2019-04-09 05:33:50 +03:00
Mike Jolley 9ea63486e6 Add get_post_status helper method and ensure prefix gets added for most statuses 2019-04-03 14:21:38 +01:00
Mike Jolley c19a39962a Correct any handling 2019-03-18 12:09:37 +00:00
Lee Willis 3573beadc1 Allow matching of "any" attributes in find_matching_product_variation. Fixes #23042 2019-03-15 16:25:26 +00:00
Timmy Crawford e1c09b4609
Merge pull request #22973 from woocommerce/update/22545
Revised sale start/end date save logic
2019-03-14 17:53:40 -07:00
Mike Jolley 8d0ec76cea Update the table on save 2019-03-13 17:33:44 +00:00
Mike Jolley 53896e3149 onsale lookup 2019-03-13 17:14:20 +00:00
Mike Jolley e2e124f365
Merge pull request #22083 from woocommerce/feature/variation-search
Added storing attribute values as post_excerpt for variations.
2019-03-13 15:09:19 +00:00
Mike Jolley 16ff51ded3 Use lookup table ID 2019-03-13 15:00:12 +00:00
Mike Jolley 4b2f7aedd4 Trigger sync after updating meta 2019-03-13 13:53:58 +00:00
Mike Jolley 0002463c61 child_has_stock_status use lookup 2019-03-13 13:48:38 +00:00
Mike Jolley d17dc119bc SKU lookup 2019-03-13 13:30:49 +00:00
Mike Jolley df0c432de2 update_product_stock should sync lookup table 2019-03-13 13:30:31 +00:00
Mike Jolley f6d9e7796f is_existing_sku use lookup 2019-03-13 13:25:55 +00:00
Mike Jolley c52eac2871 check updated props for variables 2019-03-12 19:22:30 +00:00
Peter Fabian fb0f112c6d Update the db only once if both title and attributes got updated. 2019-03-12 12:55:15 +01:00
Mike Jolley 749493b4f4
Merge pull request #22867 from woocommerce/fix/22838
Refactor delete zone/delete zone method data store to remove settings
2019-03-11 15:55:53 +00:00
Mike Jolley 587f792868 Dupe line 2019-03-11 15:55:25 +00:00
Mike Jolley fbda3a91d8 Merge feature/add-tracks into master 2019-03-11 15:15:50 +00:00
Mike Jolley e55bb84e8b
Merge pull request #22718 from woocommerce/experiment/product-sorting-index
Performance: product sorting lookup table
2019-03-11 13:27:10 +00:00
Peter Fabian d3dfee7353 Updated docs. 2019-03-09 12:09:50 +01:00
Peter Fabian ec0767b3ce Added attribute summary prop getters and setters. 2019-03-09 12:09:09 +01:00
Mike Jolley c56d3ede9f Remove day offsets 2019-03-08 13:35:30 +00:00
Mike Jolley 15ca2144d3
Merge pull request #22773 from woocommerce/performance/delete-empty-meta
Performance: delete empty meta
2019-03-08 10:22:31 +00:00
Mike Jolley 663f724bdd Cleanup methods 2019-03-07 15:08:22 +00:00
Mike Jolley dc635b9561 Update search_products to use lookup table 2019-03-07 14:46:01 +00:00
Mike Jolley 0782d39a55 Stock status 2019-03-07 14:32:20 +00:00
Mike Jolley 1ab455ec09 virtual and downloadable 2019-03-07 14:07:51 +00:00
Mike Jolley dfc539c051 SKU column 2019-03-07 13:34:28 +00:00
Mike Jolley a697c97472 Add rating_count to lookup table 2019-03-06 14:03:44 +00:00
Gerhard e36ffaa6f0 Use correct meta key _stock for updating lookup table stock. 2019-03-05 14:38:22 +02:00
Mike Jolley 5af9d968e5 Update from master 2019-03-01 10:29:17 +00:00
Mike Jolley a2606a3f1f Avoid updates on read - this is for legacy where meta was missing and shouldn't be ran for all products 2019-02-28 14:47:06 +00:00
Mike Jolley 937e0f22f0 Refactor delete zone/delete zone method data store to remove settings 2019-02-26 16:53:52 +00:00
Peter Fabian 4e177d264d Corrected comment. 2019-02-26 11:15:16 +01:00
Peter Fabian 06118db3d5 Added lazy-update of post_excerpt for variations to avoid the need for db update routine. 2019-02-26 11:11:45 +01:00
Tarik Causevic 5f87fa49e1 Correct invalid param type from id to int 2019-02-22 17:39:58 +01:00
Paul Sealock 3f8b3bc1fd _woocommerce_tracks_anon_id to customere data store 2019-02-22 11:49:14 +13:00
Paul Sealock 851a2557f6 Tracks: Add a PHP client 2019-02-22 11:48:17 +13:00
Mike Jolley 5749369ba5 Update coupons and orders to use update_or_delete_post_meta 2019-02-19 15:35:05 +00:00
Mike Jolley ea22b1cf47 Wrong var name 2019-02-19 13:24:29 +00:00
Mike Jolley c6871bb107 Use update_or_delete_post_meta - exclude _tax_class which may be empty 2019-02-19 13:23:24 +00:00
Mike Jolley 8c82333034 update_or_delete_post_meta method which does what it says 2019-02-19 13:23:09 +00:00
Mike Jolley 07eadfeb72
Merge pull request #22760 from woocommerce/performance/webhook-loading
Performance: webhook loading
2019-02-19 09:58:06 +00:00
Mike Jolley bdf77f5648
Merge pull request #22423 from woocommerce/performance/find-matching-variations
Performance - Finding matching variations
2019-02-19 09:53:34 +00:00
Mike Jolley 2529cd60cd
Merge pull request #22731 from woocommerce/update/21952
Prevent webhooks for drafts and correct create vs updated for manual orders
2019-02-19 09:50:51 +00:00
Claudio Sanches 8388325985 PHPCS ignore only what is necessary 2019-02-18 18:45:07 -03:00
Claudio Sanches 096e92554b Only disable WordPress.DB.SlowDBQuery.slow_db_query_tax_query 2019-02-18 18:42:11 -03:00
Claudio Sanches 88984da13a
Merge branch 'master' into performance/find-matching-variations 2019-02-18 18:41:17 -03:00
Claudio Sanches 4d5c6b9042 Use short cuts for wpdb properties 2019-02-18 18:38:29 -03:00
Peter Fabian 618355bcab Merge branch 'master' into feature/variation-search
# Conflicts:
#	includes/class-wc-install.php
#	includes/wc-update-functions.php
2019-02-18 17:18:44 +01:00
Mike Jolley 4fd2a9f77e Update from master 2019-02-18 15:04:58 +00:00
Mike Jolley 71d3121872 Performance: Support pagination to avoid double queries to search webhooks 2019-02-18 14:58:32 +00:00
Mike Jolley 4b3c1660f1 Dedicated count method 2019-02-18 13:41:14 +00:00
Mike Jolley d787c34206 get_webhooks_ids escaping 2019-02-18 13:34:13 +00:00
Mike Jolley 0c53145f2b Removed limit option from get_webhooks_ids - since transient stores all ids anyway, this logic makes more sense elsewhere 2019-02-18 13:13:59 +00:00
Mike Jolley 1d46294ee8 Update versions 2019-02-18 13:07:04 +00:00
Mike Jolley 3d8c58e110 status_widget_stock_rows lookups 2019-02-15 13:37:51 +00:00
Mike Jolley 35d2161fa9 Stock lookup 2019-02-15 13:05:46 +00:00
Mike Jolley 3309276e82 Renamed table to wc_product_meta_lookup 2019-02-15 12:37:45 +00:00
Mike Jolley 2a0ba812a3 Check for decoded taxonomy name when unsetting 2019-02-14 15:58:12 +00:00
Mike Jolley 13612ef3f1 Update CRUD update hook based on status transition 2019-02-13 17:55:30 +00:00
Mike Jolley ae17d6f3bd Avoid handling wc-auto-draft
WC was erroneously adding wc- prefix to the core WP auto-draft status.

#22380 registered it formally but we don't need it.

I've reverted #22380 and handled the prefix correctly.
2019-02-13 17:52:28 +00:00
Mike Jolley fe853e5d02
Merge pull request #22672 from Chouby/update_stock_filter
Allow to filter the direct sql query to update the product stock
2019-02-13 14:32:43 +00:00
Mike Jolley 4dd5cef7b9 Unused key variable 2019-02-12 14:19:37 +00:00
Mike Jolley 7f3816dfe7 Correct props to watch 2019-02-12 14:16:48 +00:00
Mike Jolley 7b6558e1df Correct table names and updater 2019-02-12 14:04:22 +00:00
Mike Jolley 64df8a2934 update lookup tables handlers and actions 2019-02-12 13:23:47 +00:00
Mike Jolley eae9f73bd2 update_lookup_table helper 2019-02-12 13:22:51 +00:00
Mike Jolley 2ebfe73524 Avoid updates on read - this is for legacy where meta was missing and shouldn't be ran for all products 2019-02-12 11:46:55 +00:00
Mike Jolley 1efe7747a8 merge conflict 2019-02-08 13:08:55 +00:00
Mike Jolley 889cf64ac4 Merge branch 'performance/wc-get-product-class' 2019-02-07 13:34:18 +00:00
Claudiu Lodromanean 2d2d7a7053
Merge pull request #22613 from woocommerce/performance/set-props
Performance: `set_props`
2019-02-06 10:02:54 -08:00
Mike Jolley 00b48febac Merge branch 'update/versioned-transients-alt' 2019-02-06 13:18:50 +00:00
Mike Jolley cb4bf5d1e5 Fix unit tests 2019-02-06 12:44:24 +00:00
Frédéric Demarle 03a60fddfc Ignore WordPress.DB.PreparedSQL.NotPrepared 2019-02-06 10:24:41 +01:00