Adding a custom Product import field to Product Importer Deluxe

Adding a custom Product import field to Product Importer Deluxe is a little more complex than adding a custom Product export field like in Store Exporter Deluxe but it’s still doable.

Note: I’ve made a task to make it as easy to add custom Product import fields to Product Importer Deluxe as we do in Store Exporter Deluxe. This will be introduced as part of the new Store Importer Deluxe Plugin (replacing Product Importer Deluxe as a free upgrade to existing customers) and after support for this new Plugin has stabilised.

First we need to add the custom Product import field to the initial import screen and then inform Product Importer Deluxe of how to prepare that data for saving against new Products if present.

Add the following PHP snippet to your current WordPress Theme’s functions.php file:

View Code
This entry was posted in . Bookmark the permalink.

9 thoughts on “Adding a custom Product import field to Product Importer Deluxe

  1. Sorry for this, I thought my replies where blocked and posted again and again))
    Yep you definitely need some better comments system, with some bbcode or something.. In tickets too btw 😉

    • No worries, I’ll clean it up and yes on both accounts; better commenting, bbcode support, etc.

      The ZenDesk support system found on My Account > Support was hand-coded as there’s no existing ZenDesk integration for customers. I’ll roll it into a Plugin when I can and get it up on the w.org’s repository.

  2. I’ll come up with a better way to accept PHP snippets in comments as WordPress chews it up and tries to over-sanitize it.

  3. This should work with ordinary WP custom fields. It does not however for ACF fields. Unless in the “function custom_woo_pd_create_product_addons” you use update_field() instead of update_post_meta().
    Strange though that if those fields are added to the “Product meta” manually, they do work. Maybe you should look into it.

    Also I find more efficient to make an array of my addon fields, and in each of those functions, except the first one, to run foreach on it. So that if you have many fields to add its easier. Here is my example:

    https://gist.github.com/SubCon/85d2a5799fa5ea019bef71c55a721a6a

    • Only thing is to put my addon fields array somewhere so it can be accessed in each function. Setting it global did not work for me, I guess there is ajax or something and those are separate sessions?

      • That’s right, our import engine (built upon WP-AJAX) is pretty strict on globals; $import and $product are available if you can extend those. I could add a WordPress Filter to the $import global right at the beginning so you could extend that and store your ACF field details within that array if needed.

        I’ll be adding native ACF import support soon, it’s high on my hit list but not as high as getting the new import Plugin out to market and in the hands of users 🙂

    • I came across this resource about update_post_meta() vs update_field(), if the value has already been set by ACF then it seems update_field() should be used whereas for new Posts update_post_meta() can be used; confusing…

      http://wordpress.stackexchange.com/questions/120895/update-post-meta-and-update-field-ony-working-when-saving-the-post

      I bet ACF hooks into wp_insert_post() and does some magic there which throws off update_post_meta() when used against a new Product, so update_field() has to be used.

      • Yep, I saw the same about update_field() too. I just wandered how was it updating correctly when the fields are added to the “Product meta” manually. Anyhow I made small changes to the code to take this into an account. You can see my gisp snippet. Also maybe remove my long code here and put the link to gisp instead?

Leave a Comment

Before you comment - Do you have a support request? If so, this is not the right place to post it. Please submit support requests for Premium Plugins on the Support page and in the community Support Forums for free Plugins.

Your email address will not be published.