Docs

WooCommerce Filters and Code Snippets

Import WP exposes filters for WooCommerce product fields, attributes, and related behaviour. Add snippets with a small custom plugin or the approach described in Using Code Snippets in WordPress.

Modify any product field

add_filter( 'iwp/woocommerce/product_field', function ( $value, $raw_value, $field ) {
	// $field examples: _regular_price, _sku, _stock, product_type, ...
	return $value;
}, 10, 3 );

Modify a specific field

add_filter( 'iwp/woocommerce/product_field/_sku', function ( $value, $raw_value ) {
	return trim( strtoupper( $raw_value ) );
}, 10, 2 );

Common field IDs: _regular_price, _sale_price, _sku, _global_unique_id, _stock, _stock_status, _manage_stock, product_type, _weight.

Attribute delimiters

Default term delimiter is ,.

// All attributes
add_filter( 'iwp/woocommerce/attribute/delimiter', function () {
	return '|';
} );

// One attribute by name
add_filter( 'iwp/woocommerce/attribute/Colour/delimiter', function () {
	return '|';
} );

Keep existing attributes on update

UI alternative: enable Keep existing Product Attributes on the Product Attributes section.

add_filter( 'iwp/woocommerce/append_attributes', '__return_true' );

Empty variation attributes on parents

By default, empty attribute terms on variable products are ignored when the attribute is used for variations.

add_filter( 'iwp/wc_ignore_empty_variable_attributes', '__return_false' );

Inline XML child variations

Only needed when variation nodes are nested under the parent in XML and you want Import WP to process them as child variations:

add_filter( 'iwp/woocommerce/xml_child_variation_attributes', function () {
	return array( 'pa_color', 'pa_size' ); // global attribute taxonomy names
} );

For most feeds, prefer flat variation rows with Product Type = variation and Advanced → Parent — see Import Variable Products and Variations.

Price examples

Fix comma decimals

add_filter( 'iwp/woocommerce/product_field/_regular_price', function ( $value, $raw ) {
	return str_replace( ',', '.', $raw );
}, 10, 2 );

Add 15% margin to regular price

add_filter( 'iwp/woocommerce/product_field/_regular_price', function ( $value, $raw ) {
	$price = floatval( str_replace( ',', '.', $raw ) );
	if ( $price <= 0 ) {
		return $value;
	}
	return wc_format_decimal( $price * 1.15 );
}, 10, 2 );

Combined price from multiple columns

If you need logic beyond a single mapped column, map one column and transform it, or use custom methods — see Custom methods / code snippets docs for patterns that combine values.