Automattic\WooCommerce\Internal\ProductFeed\Mapping
UcpProductMapper::build_price_range
Build the price range from Store API prices.
price_range is only set for variable products whose variations differ in price; everything else is a single price.
Метод класса: UcpProductMapper{}
Хуков нет.
Возвращает
array.
Использование
// private - только в коде основоного (родительского) класса $result = $this->build_price_range( $prices, $currency ): array;
- $prices(массив) (обязательный)
- Store API
pricesdata. - $currency(строка) (обязательный)
- ISO 4217 currency code.
Код UcpProductMapper::build_price_range() UcpProductMapper::build price range WC 11.3.0
private function build_price_range( $prices, string $currency ): array {
$range = $prices['price_range'] ?? null;
if ( is_array( $range ) ) {
return array(
'min' => $this->price( $range['min_amount'], $currency ),
'max' => $this->price( $range['max_amount'], $currency ),
);
}
return array(
'min' => $this->price( $prices['price'], $currency ),
'max' => $this->price( $prices['price'], $currency ),
);
}