Lifetime Licenses Are Ending Soon, Get Yours Before They're Gone
 - 
Read More
Lifetime Licenses Are Ending Soon, Get Yours Before They're Gone
 - 
Read More
Pricing

You may have seen some references on our site to annual licensing or renewals.

All plugins currently come with a lifetime license, no matter what the site says.

We’re currently running tests before we make the switch to annual pricing. Check the Discounts tab to purchase our other plugins and get a lifetime license before they’re gone.

I Understand I Have a Lifetime License
Now is your last chance to buy a lifetime license before we switch to annual pricing. Existing licenses will be unaffected.
Read More

Calling PHP Functions In Your Import Configuration

You can execute any PHP function (native functions or user-defined functions) from inside virtually any text box (post title, post content, Custom Field values, etc.) in WP All Import. You can even pass values from your data file to the PHP function.

Example 1 – (Inline PHP) Using the Native str_replace Function to Remove Commas

Here, we’re using the str_replace function to remove commas from the post title:

[str_replace(",", "", {title[1]})]
string replace example

Note the use of double quotes instead of single quotes. You must use double quotes when executing PHP functions from within WP All Import. You can’t use single quotes.

Example 2 – Custom Code in the Function Editor

WP All Import has a built-in code editor where you can write your own custom functions. You can access the Function Editor when editing your import template or via All Import › Settings in your WordPress dashboard.

The Function Editor makes code editing easy:

  • Syntax highlighting
  • Built-in linting to prevent site-breaking errors
  • Code only runs during an import
  • Write and test code on the edit import page using the Preview feature

For example, let’s say we are importing WooCommerce products and need to increase the price by 50%, as well as round it so that it looks nice.

We can do this by writing a custom PHP function to process and return the desired price.

Here’s an example of a function that you could use:

function round_price( $price = null, $multiplier = 1, $nearest = .01, $minus = 0 ) {
if ( !empty( $price ) ) {
// strip any extra characters from price
$price = preg_replace("/[^0-9,.]/", "", $price);
// perform calculations
return ( round ( ( $price * $multiplier ) / $nearest ) * $nearest ) - $minus;
}
}

This can be added directly to the Function Editor on the Edit Import page:

Function Editor Example

We can then call this function in the Regular Price field provided by our WooCommerce Add-On, where we can customize it based on our needs. We want to set the multiplier to 1.5, so our prices are increased by 50%. We want to set the round parameter to 10, so prices will be rounded to the nearest $10. And finally, we want to set the minus parameter to .01, so we get prices ending in $.99.

[round_price({price[1]},"1.5","10",".01")]

This way, a product with a price of $55 will be imported with a price of $79.99.

Function in import template

You can set the parameters however you wish or modify the code itself to do something else. Writing code in the Function Editor is easy, fast, and infinitely customizable. Once you click Save Functions, you can click the Preview button to see the results and then modify as needed.

Related Docs

Code snippets and examples that are available for WP All Import.

Learn about our action reference and our API.

Use PHP functions (either native or custom) in WP All Export.

The best import export plugin for WordPress & WooCommerce.

Complete, granular control of your data with an easy to use drag & drop interface.
  • 90 Day Money Back Guarantee
  • Unlimited Installs
  • Lifetime Licence
  • Fast, World-Class Support
Get Started
90 Day Money Back Guarantee

Lifetime support. Lifetime updates. Pay once.

Packages
Standalone
Import
Pro Package
$299
one-time
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
Import + Export Pro Package
$399
one-time
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
WooCommerce Import Package
$199
one-time
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
Import Standalone
$99
one-time
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
Import + Export Standalone
$169
one-time
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
Export Standalone
$99
one-time
  • Import Pro
Import Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
  • Export Pro
Export Add-Ons
  • Woo
  • ACF
  • Meta Box
  • JetEngine
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee

Lifetime support. Lifetime updates. Pay once.

Import
Pro Package
$199
one-time
  • Import Pro
Import Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
  • Types
  • Export Pro
Export Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
Import + Export Pro Package
$299
one-time
  • Import Pro
Import Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
  • Types
  • Export Pro
Export Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
Export
Pro Package
$199
one-time
  • Import Pro
Import Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
  • Types
  • Export Pro
Export Add-Ons
  • WooCo
  • ACF
  • Gravity Forms
  • Users
Add to Cart
90 Day Money Back Guarantee
cross