Merge pull request #13531 from woocommerce/fix/legacy-coupon-amount-property
Fix direct property access for coupon amount.
This commit is contained in:
commit
6b959e8625
|
@ -30,6 +30,7 @@ abstract class WC_Legacy_Coupon extends WC_Data {
|
||||||
'type',
|
'type',
|
||||||
'discount_type',
|
'discount_type',
|
||||||
'amount',
|
'amount',
|
||||||
|
'coupon_amount',
|
||||||
'code',
|
'code',
|
||||||
'individual_use',
|
'individual_use',
|
||||||
'product_ids',
|
'product_ids',
|
||||||
|
@ -82,6 +83,7 @@ abstract class WC_Legacy_Coupon extends WC_Data {
|
||||||
$value = $this->get_discount_type();
|
$value = $this->get_discount_type();
|
||||||
break;
|
break;
|
||||||
case 'amount' :
|
case 'amount' :
|
||||||
|
case 'coupon_amount' :
|
||||||
$value = $this->get_amount();
|
$value = $this->get_amount();
|
||||||
break;
|
break;
|
||||||
case 'code' :
|
case 'code' :
|
||||||
|
|
|
@ -39,6 +39,7 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
|
||||||
'type',
|
'type',
|
||||||
'discount_type',
|
'discount_type',
|
||||||
'amount',
|
'amount',
|
||||||
|
'coupon_amount',
|
||||||
'code',
|
'code',
|
||||||
'individual_use',
|
'individual_use',
|
||||||
'product_ids',
|
'product_ids',
|
||||||
|
@ -68,6 +69,7 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
|
||||||
$this->assertEquals( $coupon->get_discount_type(), $coupon->type );
|
$this->assertEquals( $coupon->get_discount_type(), $coupon->type );
|
||||||
$this->assertEquals( $coupon->get_discount_type(), $coupon->discount_type );
|
$this->assertEquals( $coupon->get_discount_type(), $coupon->discount_type );
|
||||||
$this->assertEquals( $coupon->get_amount(), $coupon->amount );
|
$this->assertEquals( $coupon->get_amount(), $coupon->amount );
|
||||||
|
$this->assertEquals( $coupon->get_amount(), $coupon->coupon_amount );
|
||||||
$this->assertEquals( $coupon->get_code(), $coupon->code );
|
$this->assertEquals( $coupon->get_code(), $coupon->code );
|
||||||
$this->assertEquals( $coupon->get_individual_use(), ( 'yes' === $coupon->individual_use ? true : false ) );
|
$this->assertEquals( $coupon->get_individual_use(), ( 'yes' === $coupon->individual_use ? true : false ) );
|
||||||
$this->assertEquals( $coupon->get_product_ids(), $coupon->product_ids );
|
$this->assertEquals( $coupon->get_product_ids(), $coupon->product_ids );
|
||||||
|
|
Loading…
Reference in New Issue