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

ShopifyMapper::map_enhanced_statusprivateWC 1.0

Maps enhanced publication status fields from Shopify.

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

Хуков нет.

Возвращает

Массив. Enhanced status data.

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

// private - только в коде основоного (родительского) класса
$result = $this->map_enhanced_status( $shopify_product ): array;
$shopify_product(объект) (обязательный)
The Shopify product data.

Код ShopifyMapper::map_enhanced_status() WC 10.8.1

private function map_enhanced_status( object $shopify_product ): array {
	$status_data = array();

	// Publication date.
	if ( property_exists( $shopify_product, 'publishedAt' ) && $shopify_product->publishedAt ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- GraphQL uses camelCase.
		$status_data['date_published_gmt'] = $shopify_product->publishedAt; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- GraphQL uses camelCase.
	}

	// Available for sale flag.
	if ( property_exists( $shopify_product, 'availableForSale' ) ) {
		$status_data['available_for_sale'] = $shopify_product->availableForSale; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase -- GraphQL uses camelCase.
	}

	return $status_data;
}