wc_importer_shopify_special_mappings()WC 3.7.0

Add special wildcard Shopify mappings.

No Hooks.

Return

Array.

Usage

wc_importer_shopify_special_mappings( $mappings, $raw_headers );
$mappings(array) (required)
Importer columns mappings.
$raw_headers(array) (required)
Raw headers from CSV being imported.

Changelog

Since 3.7.0 Introduced.

wc_importer_shopify_special_mappings() code 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 );
}