Automattic\WooCommerce\Internal\ProductFeed\Mapping

UcpProductMapper::map_products │ public │ WC 1.0

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

Method of the class: UcpProductMapper{}

No Hooks.

Returns

array.

Usage

$UcpProductMapper = new UcpProductMapper();
$UcpProductMapper->map_products( $products ): array;
$products(array) (required)
WooCommerce products.

UcpProductMapper::map_products() code 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;
}