Merge branch 'issue/31555-add-status-field-coupons-api' into issue/31562-filter-coupons-by-status

This commit is contained in:
anitaamurthy 2022-01-06 10:54:41 +05:30
commit 89d8cb6a9b
3 changed files with 4 additions and 3 deletions

View File

@ -123,7 +123,7 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
array(
'code' => $post_object->post_title,
'description' => $post_object->post_excerpt,
'status' => $post_object->post_status,
'status' => $post_object->post_status,
'date_created' => $this->string_to_timestamp( $post_object->post_date_gmt ),
'date_modified' => $this->string_to_timestamp( $post_object->post_modified_gmt ),
'date_expires' => metadata_exists( 'post', $coupon_id, 'date_expires' ) ? get_post_meta( $coupon_id, 'date_expires', true ) : get_post_meta( $coupon_id, 'expiry_date', true ), // @todo: Migrate expiry_date meta to date_expires in upgrade routine.

View File

@ -348,8 +348,8 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller {
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'status' => array(
'description' => __( 'The status of the coupon. Should always be draft, published or pending review', 'woocommerce' ),
'status' => array(
'description' => __( 'The status of the coupon. Should always be draft, published, or pending review', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),

View File

@ -174,6 +174,7 @@ class WC_Tests_Coupon_Data extends WC_Unit_Test_Case {
'description' => 'hello world',
'discount_type' => 'percent',
'amount' => 10.50,
'status' => 'publish',
'usage_count' => 5,
'individual_use' => true,
'product_ids' => array( 5, 10 ),