Set access modifier for $error_message to public and added a setter method (#46642)
* Set access modifier for $error_message to public and added a setter method. * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
e8a2c20914
commit
77f7b6162b
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fixed a bug causing incompatibility with 3rd-party coupon extensions when certain conditions were met.
|
|
@ -84,9 +84,14 @@ class WC_Coupon extends WC_Legacy_Coupon {
|
|||
/**
|
||||
* Error message.
|
||||
*
|
||||
* This property should not be considered public API, and should not be accessed directly.
|
||||
* It is being added to supress PHP > 8.0 warnings against dynamic property creation, and all access
|
||||
* should be through the getter and setter methods, namely `get_error_message()` and `set_error_message()`.
|
||||
* In the future, the access modifier may be changed back to protected.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $error_message;
|
||||
public $error_message;
|
||||
|
||||
/**
|
||||
* Sorting.
|
||||
|
@ -871,6 +876,17 @@ class WC_Coupon extends WC_Legacy_Coupon {
|
|||
return $this->error_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the error_message string.
|
||||
*
|
||||
* @param string $message Message string.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_error_message( string $message ) {
|
||||
$this->error_message = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a coupon is valid for the cart.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue