fix `0` value attribute permalink calculation, property population in REST api
This commit is contained in:
parent
83cb978c9e
commit
45370d3e61
|
@ -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 ) {
|
foreach ( $product->get_variation_attributes() as $attribute_name => $attribute ) {
|
||||||
$name = str_replace( 'attribute_', '', $attribute_name );
|
$name = str_replace( 'attribute_', '', $attribute_name );
|
||||||
|
|
||||||
if ( ! $attribute ) {
|
if ( empty( $attribute ) && '0' !== $attribute ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ class WC_Product_Variation extends WC_Product_Simple {
|
||||||
$data = $this->get_variation_attributes();
|
$data = $this->get_variation_attributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array_filter( $data );
|
$data = array_filter( $data, 'wc_array_filter_default_attributes' );
|
||||||
|
|
||||||
if ( empty( $data ) ) {
|
if ( empty( $data ) ) {
|
||||||
return $url;
|
return $url;
|
||||||
|
|
Loading…
Reference in New Issue