Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Shopify
ShopifyMapper::map_product_data
Maps raw Shopify product data to a standardized array format.
Метод класса: ShopifyMapper{}
Хуков нет.
Возвращает
Массив. Standardized data array for WooCommerce_Product_Importer.
Использование
$ShopifyMapper = new ShopifyMapper(); $ShopifyMapper->map_product_data( $shopify_product ): array;
- $shopify_product(объект) (обязательный)
- The raw Shopify product node from GraphQL.
Код ShopifyMapper::map_product_data() ShopifyMapper::map product data WC 10.9.4
public function map_product_data( object $shopify_product ): array {
$is_variable = $this->is_variable_product( $shopify_product );
$wc_data = $this->map_basic_product_fields( $shopify_product, $is_variable );
// Map simple product data (for non-variable products).
if ( ! $is_variable ) {
$simple_data = $this->map_simple_product_data( $shopify_product );
$wc_data = array_merge( $wc_data, $simple_data );
}
// Map product images.
$wc_data['images'] = $this->map_product_images( $shopify_product );
// Map metafields and SEO data.
$wc_data['metafields'] = $this->map_metafields( $shopify_product );
// Map variable product data (attributes and variations).
$variable_data = $this->map_variable_product_data( $shopify_product, $is_variable );
$wc_data = array_merge( $wc_data, $variable_data );
return $wc_data;
}