Import Product Pricing
Map product prices in the Pricing section of the WooCommerce Products template. Prices are formatted with WooCommerce’s wc_format_decimal() before save.
Table of Contents
Pricing fields
| Field | Description |
|---|---|
| Regular Price | Standard product price |
| Sale Price | Discounted price (enable the Sale Price subgroup) |
| Sale Price From | Optional sale start datetime |
| Sale Price To | Optional sale end datetime |
Simple product example
| Name | SKU | Regular Price | Sale Price |
|---|---|---|---|
| Simple Product 1 | simple-one | 19.99 | 14.99 |
| Simple Product 2 | simple-two | 29.99 |
Map Regular Price and optionally Sale Price. Leave sale price empty when the product is not on sale.
Sale price and schedule
- Enable the Sale Price fields.
- Map Sale Price.
- Optionally map Sale Price From / Sale Price To using a datetime WooCommerce accepts (typically
YYYY-MM-DDorYYYY-MM-DD HH:MM:SS).
If sale prices are not updating on re-import:
- Confirm Update is enabled and price fields are not excluded in permissions
- Confirm the unique identifier matches existing products
- Confirm the sale price column is not empty when you expect a value (empty values may clear or skip depending on mapping/permissions)
Variation prices
For variable products, set Regular Price / Sale Price on each variation row. Parent variable products do not need a single selling price in the same way — WooCommerce derives the display range from variations.
See Import Variable Products and Variations.
Price-only updates
- Map SKU + price fields only.
- Unique identifier = Product SKU.
- Permissions: Update enabled; optionally Create disabled.
- Restrict update to pricing fields so other product data is untouched.
See Update Existing WooCommerce Products.
Transforming prices (margins, commas, currency)
Decimal commas
If your feed uses European decimals (12,99):
add_filter( 'iwp/woocommerce/product_field/_regular_price', function ( $value, $raw ) {
$raw = str_replace( '.', '', $raw ); // optional: strip thousand separators
return str_replace( ',', '.', $raw );
}, 10, 2 );
add_filter( 'iwp/woocommerce/product_field/_sale_price', function ( $value, $raw ) {
$raw = str_replace( '.', '', $raw );
return str_replace( ',', '.', $raw );
}, 10, 2 );
Add a percentage margin
add_filter( 'iwp/woocommerce/product_field/_regular_price', function ( $value, $raw ) {
$price = floatval( $raw );
if ( $price <= 0 ) {
return $value;
}
$margin = 1.20; // +20%
return wc_format_decimal( $price * $margin );
}, 10, 2 );
Skip importing a price below a minimum
Combine a price filter with record filtering, or zero-out invalid prices:
add_filter( 'iwp/woocommerce/product_field/_regular_price', function ( $value, $raw ) {
$price = floatval( str_replace( ',', '.', $raw ) );
if ( $price > 0 && $price < 5 ) {
return ''; // or keep previous via permissions / custom logic
}
return $price;
}, 10, 2 );
More examples: WooCommerce Filters and Code Snippets and Using Code Snippets in WordPress.
Preventing unwanted price changes
- Use Permissions → Update → None of the following fields to block
_regular_price/_sale_pricewhen a feed should not change prices. - Or use Only the following fields when the feed should change only prices.
- Do not map price columns at all if they must never change.