[REST API] Save default total_sales, closes #10898

This commit is contained in:
Claudio Sanches 2016-05-11 13:19:56 -03:00
parent 47ef7e17a1
commit ccd1f48025
3 changed files with 9 additions and 0 deletions

View File

@ -847,6 +847,9 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
}
}
// Default total sales.
add_post_meta( $product_id, 'total_sales', '0', true );
// Virtual.
if ( isset( $request['virtual'] ) ) {
update_post_meta( $product->id, '_virtual', true === $request['virtual'] ? 'yes' : 'no' );

View File

@ -806,6 +806,9 @@ class WC_API_Products extends WC_API_Resource {
}
}
// Default total sales.
add_post_meta( $product_id, 'total_sales', '0', true );
// Virtual
if ( isset( $data['virtual'] ) ) {
update_post_meta( $product_id, '_virtual', ( true === $data['virtual'] ) ? 'yes' : 'no' );

View File

@ -1291,6 +1291,9 @@ class WC_API_Products extends WC_API_Resource {
}
}
// Default total sales.
add_post_meta( $product_id, 'total_sales', '0', true );
// Virtual.
if ( isset( $data['virtual'] ) ) {
update_post_meta( $product_id, '_virtual', ( true === $data['virtual'] ) ? 'yes' : 'no' );