Merge pull request #4340 from maxrice/rest-api-warning-fixes
Fix warning when accessing coupons created in pre-2.1 installs
This commit is contained in:
commit
6a194f02e2
|
@ -118,8 +118,8 @@ class WC_API_Coupons extends WC_API_Resource {
|
|||
'updated_at' => $this->server->format_datetime( $coupon_post->post_modified_gmt ),
|
||||
'amount' => wc_format_decimal( $coupon->amount, 2 ),
|
||||
'individual_use' => ( 'yes' === $coupon->individual_use ),
|
||||
'product_ids' => array_map( 'absint', $coupon->product_ids ),
|
||||
'exclude_product_ids' => array_map( 'absint', $coupon->exclude_product_ids ),
|
||||
'product_ids' => array_map( 'absint', (array) $coupon->product_ids ),
|
||||
'exclude_product_ids' => array_map( 'absint', (array) $coupon->exclude_product_ids ),
|
||||
'usage_limit' => ( ! empty( $coupon->usage_limit ) ) ? $coupon->usage_limit : null,
|
||||
'usage_limit_per_user' => ( ! empty( $coupon->usage_limit_per_user ) ) ? $coupon->usage_limit_per_user : null,
|
||||
'limit_usage_to_x_items' => (int) $coupon->limit_usage_to_x_items,
|
||||
|
@ -127,8 +127,8 @@ class WC_API_Coupons extends WC_API_Resource {
|
|||
'expiry_date' => $this->server->format_datetime( $coupon->expiry_date ),
|
||||
'apply_before_tax' => $coupon->apply_before_tax(),
|
||||
'enable_free_shipping' => $coupon->enable_free_shipping(),
|
||||
'product_category_ids' => array_map( 'absint', $coupon->product_categories ),
|
||||
'exclude_product_category_ids' => array_map( 'absint', $coupon->exclude_product_categories ),
|
||||
'product_category_ids' => array_map( 'absint', (array) $coupon->product_categories ),
|
||||
'exclude_product_category_ids' => array_map( 'absint', (array) $coupon->exclude_product_categories ),
|
||||
'exclude_sale_items' => $coupon->exclude_sale_items(),
|
||||
'minimum_amount' => wc_format_decimal( $coupon->minimum_amount, 2 ),
|
||||
'customer_emails' => $coupon->customer_email,
|
||||
|
|
Loading…
Reference in New Issue