Skip to content

Commit

Permalink
Fix: Suppress deprecated warning when applying a coupon on Cart in PH…
Browse files Browse the repository at this point in the history
…P > 8.0 (#45981)

* Fix deprecated warning when applying a coupon on Cart in PHP > 8.0

* Add changefile(s) from automation for the following project(s): woocommerce

* Changed property type to protected

---------

Co-authored-by: github-actions <github-actions@github.com>
  • Loading branch information
wavvves and github-actions committed Mar 27, 2024
1 parent 3513af5 commit 7c75791
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix
Comment: Fix: Suppress deprecated warning when applying a coupon on Cart in PHP > 8.0

2 changes: 1 addition & 1 deletion plugins/woocommerce/includes/class-wc-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public static function apply_coupon() {
$coupon_code = ArrayUtil::get_value_or_default( $_POST, 'coupon_code' );
$billing_email = ArrayUtil::get_value_or_default( $_POST, 'billing_email' );

if ( is_email( $billing_email ) ) {
if ( is_string( $billing_email ) && is_email( $billing_email ) ) {
wc()->customer->set_billing_email( $billing_email );
}

Expand Down
7 changes: 7 additions & 0 deletions plugins/woocommerce/includes/class-wc-coupon.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ class WC_Coupon extends WC_Legacy_Coupon {
*/
protected $cache_group = 'coupons';

/**
* Error message.
*
* @var string
*/
protected $error_message;

/**
* Sorting.
*
Expand Down

0 comments on commit 7c75791

Please sign in to comment.