Automattic\WooCommerce\Internal\ProductFeed\Mapping

UcpProductMapper::build_variant_list_price │ private │ WC 1.0

Build a variant's list price when it is genuinely discounted.

Compares against the effective price so expired or scheduled sales are excluded.

Method of the class: UcpProductMapper{}

No Hooks.

Returns

array|null.

Usage

// private - for code of main (parent) class only
$result = $this->build_variant_list_price( $prices, $currency );
$prices(array) (required)
Store API prices data.
$currency(string) (required)
ISO 4217 currency code.

UcpProductMapper::build_variant_list_price() code WC 11.3.0

private function build_variant_list_price( $prices, string $currency ) {
	if ( (int) $prices['regular_price'] <= (int) $prices['price'] ) {
		return null;
	}

	return $this->price( $prices['regular_price'], $currency );
}