Commit Graph

70 Commits

Author SHA1 Message Date
Roy Ho d8b0a8558e
Merge pull request #28586 from idofri/phpdoc
Corrected data-types in phpdoc @param
2021-01-11 06:52:11 -08:00
vedanshujain 6b550ffb23 Better error messages for when coupon are held in other transactions.
Earlier, we were just showing an "Usage limit reached message", however in some cases, specially when user is logged in, we can also ask them to go to MyAccount page and cancel order if they'd like to (to free up the coupon). This will hopefully make for a better user experience.
2020-12-16 15:19:40 +05:30
Ido F 703d474e52 corrected data-types in phpdoc @param 2020-12-14 13:31:52 +02:00
James Allan 82b68b4914 Use strict comparison to compare post dates
With PHP 8.0, non-strict comparisons between integers and strings containing
non-numeric characters are being tightened. This affects comparisons like:

0 < '0000-00-00 00:00:00'

PHP 8.0 that equates to true whereas prior to 8.0 it would be false.

More details of this change can be found at: https://wiki.php.net/rfc/string_to_number_comparison
2020-11-02 11:10:30 +10:00
Claudio Sanches 02cf0dfaed
Merge pull request #27239 from woocommerce/fix/package-tag
Fix usage of "package" tag in file headers
2020-08-07 13:37:24 -03:00
Claudio Sanches 525db3aa21 Fixed incorrect package tags 2020-08-05 17:49:10 -03:00
Claudio Sanches e94196cea8 Sanitize coupon code in coupon ID by code functions 2020-07-27 17:33:15 -03:00
Claudio Sanches 85d7cdbbb4 Allow schedule coupons via CRUD 2020-05-05 16:35:10 -03:00
vedanshujain 509b2c180d Set usage count as its required by usages query 2020-03-11 20:44:52 +05:30
Rodrigo Primo 0aa438e031 Add version to @since tag of WC_Coupon_Data_Store_CPT::updated_props
See #25755
2020-03-04 15:57:17 -03:00
Patricia Hillebrandt c3379482a2 Updating docblock 2020-02-25 16:53:40 +01:00
Patricia Hillebrandt bd53e2eb60 Prevents the Undefined property error when updating the post meta for a given coupon 2020-02-23 14:07:18 +01:00
vedanshujain ba2d825800 Use DB timestamp to ensure consistency between servers. 2019-12-17 19:13:19 +05:30
vedanshujain 9b7343d23b Applied coding standards 2019-12-17 19:13:19 +05:30
vedanshujain 53bfcea110 Use same filter for stocks and coupon for consistency. 2019-12-17 19:13:19 +05:30
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
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 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
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 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
Mike Jolley e354bb90aa Pass objects to new/update actions 2019-04-17 12:50:46 +01:00
Mike Jolley 5749369ba5 Update coupons and orders to use update_or_delete_post_meta 2019-02-19 15:35:05 +00:00
Rodrigo Primo 6ec2b26972 Update WordPress.DB.PreparedSQL.NotPrepared sniff name
The latest version of WPCS that was added to WC last week, changed the name of some sniffs. This commit updates the name of one of those sniffs from WordPress.WP.PreparedSQL.NotPrepared to WordPress.DB.PreparedSQL.NotPrepared.
2018-11-23 15:10:52 -02:00
Rodrigo Primo 57f44798cb Fix phpcs violations automatically using phpcbf 2018-11-23 12:57:51 -02:00
Claudio Sanches 2fcabfe7e6 /reports/coupons/totals endpoint 2018-09-08 21:04:13 -03:00
Tim Jensen e2cc3673b2 Add coupon usage count hooks
These action hooks allow developers to extend functionality related to updating coupon usage counts.
2018-05-06 07:09:59 -04:00
Rodrigo Primo 5eda520170 phpcs fixes in includes/data-stores/class-wc-coupon-data-store-cpt.php 2018-03-08 16:27:31 -03:00
Rodrigo Primo 2b5103c849 Fix phpcs violations using phpcbf 2018-03-08 14:30:43 -03:00
Joel Rowley 521bde2fba Bugfix: coupon object cache not being cleared upon deletion 2017-09-09 22:47:25 -04:00
Mike Jolley ed32f9c792 Only delete if the object has an ID 2017-05-30 14:44:28 +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
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
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 1b5cad3d78 Fix variation category restriction and limit to x uses
Fixes #14068
2017-04-06 21:51:11 +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
Mike Jolley 7e462b9cca Data store date handling 2017-03-23 00:10:29 +00:00
Mike Jolley 3b35d95c6a Use gmdate and GMT in data stores so times are not changed 2017-03-22 12:01:38 +00: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
Claudiu Lodromanean 111246771c Use date_expires meta key 2017-03-15 07:38:57 -07:00
Claudiu Lodromanean cb3568add9 Add new meta key to internal meta keys 2017-03-14 14:14:07 -07:00
Claudiu Lodromanean 9e724d44cc Save expiry time in new utc timestamp meta field 2017-03-14 12:49:40 -07:00
Claudiu Lodromanean 3476121709 Use local time where appropriate 2017-03-14 10:27:48 -07:00
Claudiu Lodromanean f042305ff7 Update date_expires meta handling 2017-03-14 08:10:31 -07:00
Claudiu Lodromanean b3c846da56 Use 2.6-format data for the expiry_date meta value 2017-03-13 14:37:34 -07:00