Home Forums Plugins Product Importer Deluxe [Resolved] Custom fields import manipulation Reply To: [Resolved] Custom fields import manipulation


Ok so I got into this a bit:
1) woo_pd_prepare_product does not exist.
So I looked into “woo_pd_merge_product_addons” which needs to be followed by “woo_pd_merge_product_log_addons”. You also make comparison if new value is different from old.
So we need to load existing product values fist using “woo_pd_merge_product_data_addons”.
I think you might want to add these to that snippet/tutorial on how to add custom fields to the import. Coz I didn’t know that there are different hooks for merging.

BTW I made a simple solution so that I’ll not need to write the custom fields array on each hook function. So I made a simple function that I can call and it gives me the fields. I only need to add/edit them in one place.

function alo_import_product_fields( $fields ) {
$woo_ped_addon_fields = array();
$woo_ped_addon_fields[] = array(
‘name’ => ‘newprod_date’,
‘label’ => ‘New Product Date’,
‘acf’ => true,
‘group_open’ => ‘<optgroup label=”Extra Fields”>’
$woo_ped_addon_fields[] = array(
‘name’ => ‘prod_type_abnab’,
‘label’ => ‘Product Type ab/nab’,
‘acf’ => true,
$woo_ped_addon_fields[] = array(
‘name’ => ‘wc_productdata_options’,
‘label’ => ‘AB/NAB Fields’

$fields = array_merge($fields, $woo_ped_addon_fields);

return $fields;

Maybe you can use it.