fix `0` value attribute permalink calculation, property population in REST api

This commit is contained in:
Ron Rennick 2018-11-23 11:00:30 -04:00
parent 83cb978c9e
commit 45370d3e61
2 changed files with 2 additions and 2 deletions

View File

@ -524,7 +524,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_Legacy_Products_Controller
foreach ( $product->get_variation_attributes() as $attribute_name => $attribute ) {
$name = str_replace( 'attribute_', '', $attribute_name );
if ( ! $attribute ) {
if ( empty( $attribute ) && '0' !== $attribute ) {
continue;
}

View File

@ -167,7 +167,7 @@ class WC_Product_Variation extends WC_Product_Simple {
$data = $this->get_variation_attributes();
}
$data = array_filter( $data );
$data = array_filter( $data, 'wc_array_filter_default_attributes' );
if ( empty( $data ) ) {
return $url;