Automattic\WooCommerce\Internal\ProductFeed\Mapping

UcpProductMapper::map_products │ public │ WC 1.0

Map a page of products, skipping those with no catalog variant.

Метод класса: UcpProductMapper{}

Хуков нет.

Возвращает

array.

Использование

$UcpProductMapper = new UcpProductMapper();
$UcpProductMapper->map_products( $products ): array;
$products(массив) (обязательный)
WooCommerce products.

Код UcpProductMapper::map_products() WC 11.3.0

public function map_products( array $products ): array {
	$this->begin_response();

	$mapped = array();

	foreach ( $products as $product ) {
		if ( ! $product instanceof \WC_Product ) {
			continue;
		}

		if ( ! $this->has_catalog_variants( $product ) ) {
			continue;
		}

		$mapped[] = $this->map_product( $product );
	}

	return $mapped;
}