wc_importer_shopify_special_mappings()WC 3.7.0

Add special wildcard Shopify mappings.

Хуков нет.

Возвращает

Массив.

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

wc_importer_shopify_special_mappings( $mappings, $raw_headers );
$mappings(массив) (обязательный)
Importer columns mappings.
$raw_headers(массив) (обязательный)
Raw headers from CSV being imported.

Список изменений

С версии 3.7.0 Введена.

Код wc_importer_shopify_special_mappings() WC 8.7.0

function wc_importer_shopify_special_mappings( $mappings, $raw_headers ) {
	// Only map if this is looks like a Shopify export.
	if ( 0 !== count( array_diff( array( 'Title', 'Body (HTML)', 'Type', 'Variant SKU' ), $raw_headers ) ) ) {
		return $mappings;
	}
	$shopify_mappings = array(
		'Option%d Name'  => 'attributes:name',
		'Option%d Value' => 'attributes:value',
	);
	return array_merge( $mappings, $shopify_mappings );
}