Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Shopify

ShopifyMapper::map_seo_fieldsprivateWC 1.0

Maps SEO fields from Shopify product data.

Method of the class: ShopifyMapper{}

No Hooks.

Returns

Array. SEO metafields data.

Usage

// private - for code of main (parent) class only
$result = $this->map_seo_fields( $shopify_product ): array;
$shopify_product(object) (required)
The Shopify product data.

ShopifyMapper::map_seo_fields() code WC 10.8.1

private function map_seo_fields( object $shopify_product ): array {
	$seo_data = array();

	if ( property_exists( $shopify_product, 'seo' ) && is_object( $shopify_product->seo ) ) {
		if ( ! empty( $shopify_product->seo->title ) ) {
			$seo_data['global_title_tag'] = $shopify_product->seo->title;
		}
		if ( ! empty( $shopify_product->seo->description ) ) {
			$seo_data['global_description_tag'] = $shopify_product->seo->description;
		}
	}

	return $seo_data;
}