Add has_options to product REST API response. Closes #30187.
This commit is contained in:
parent
8bc310008c
commit
7ac79aa6d7
|
@ -1220,6 +1220,12 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller {
|
|||
),
|
||||
),
|
||||
),
|
||||
'has_options' => array(
|
||||
'description' => __( 'Shows if the product needs confiruging before it can be bought.', 'woocommerce' ),
|
||||
'type' => 'boolean',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
),
|
||||
'attributes' => array(
|
||||
'description' => __( 'List of attributes.', 'woocommerce' ),
|
||||
'type' => 'array',
|
||||
|
@ -1381,6 +1387,9 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller {
|
|||
if ( in_array( 'stock_status', $fields ) ) {
|
||||
$data['stock_status'] = $product->get_stock_status( $context );
|
||||
}
|
||||
if ( in_array( 'has_options', $fields ) ) {
|
||||
$data['has_options'] = $product->has_options( $context );
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue