Programatically import custom fields using wp all import [closed]

WP All Import has a lot of undocumented features in the various hooks, actions and filters implemented in the code. The easiest way to do such a mapping is to add a filter to the pmxi_options_options and add custom rules. These rules will show up under the Custom Fields accordion during the import configuration step.

<?php
add_filter( 'pmxi_options_options', function( $options ) {
  // Match the desired custom post type
  if ( $options['custom_type'] != 'product' ) {
    return $options;
  }
  // Configure the custom fields
  $options['custom_name']['custom_field_name'] = '_custom_field_name';
  $options['custom_value']['custom_field_name'] = '{csv_column[1]}';
  $options['custom_mapping_rules']['custom_field_name'] = json_encode( [
    'value_from_csv' => 'value_to_custom_field',
    'en' => 'English',
  ] );
  return $options;
} );

enter image description here