Switch data_type

This commit is contained in:
Mike Jolley 2019-03-25 15:10:56 +00:00
parent 1e0ed1d20c
commit eb45b94edb
2 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,7 @@ class WC_Meta_Box_Coupon_Data {
'label' => __( 'Coupon amount', 'woocommerce' ),
'placeholder' => wc_format_localized_price( 0 ),
'description' => __( 'Value of the coupon.', 'woocommerce' ),
'data_type' => 'price',
'data_type' => 'percent' === $coupon->get_discount_type( 'edit' ) ? 'decimal' : 'price',
'desc_tip' => true,
'value' => $coupon->get_amount( 'edit' ),
)

View File

@ -199,7 +199,7 @@ class WC_Coupon extends WC_Legacy_Coupon {
* @return float
*/
public function get_amount( $context = 'view' ) {
return (float) $this->get_prop( 'amount', $context );
return wc_format_decimal( $this->get_prop( 'amount', $context ) );
}
/**