Fixes notices

This commit is contained in:
Mike Jolley 2016-08-26 15:24:01 +01:00
parent ed01282340
commit 5c40236d79
2 changed files with 5 additions and 4 deletions

View File

@ -148,7 +148,7 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
// Format decimal values.
foreach ( $format_decimal as $key ) {
$data[ $key ] = wc_format_decimal( $data[ $key ], $this->request['dp'] );
$data[ $key ] = wc_format_decimal( $data[ $key ], 2 );
}
// Format date values.
@ -388,7 +388,7 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
$coupon->set_usage_limit_per_user( $data['usage_limit_per_user'] );
$coupon->set_limit_usage_to_x_items( $data['limit_usage_to_x_items'] );
$coupon->set_usage_count( $data['usage_count'] );
$coupon->set_date_expires(( $data['expiry_date'] );
$coupon->set_date_expires( $data['expiry_date'] );
$coupon->set_free_shipping( $data['free_shipping'] );
$coupon->set_product_categories( $data['product_categories'] );
$coupon->set_excluded_product_categories( $data['excluded_product_categories'] );
@ -445,11 +445,11 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
}
if ( isset( $request['expiry_date'] ) ) {
$coupon->set_date_expires(( $request['expiry_date'] );
$coupon->set_date_expires( $request['expiry_date'] );
}
if ( isset( $request['date_expires'] ) ) {
$coupon->set_date_expires(( $request['date_expires'] );
$coupon->set_date_expires( $request['date_expires'] );
}
if ( isset( $request['free_shipping'] ) ) {

View File

@ -86,6 +86,7 @@ class WC_Coupon extends WC_Legacy_Coupon {
'usage_limit_per_user', 'limit_usage_to_x_items', 'free_shipping',
'product_categories', 'exclude_product_categories', 'exclude_sale_items',
'minimum_amount', 'maximum_amount', 'customer_email', '_used_by',
'_edit_lock', '_edit_last',
);
/**