loading...

WooCommerce Default Import & Export : How to return error when using woocommerce_product_import_pre_insert_product_object

bhanusingh profile image BhanuSingh ・1 min read

I am adding support to import custom taxonomy in a WooCommerce store.

function process_import( $object, $data ) {
  if (is_a($object, 'WC_Product')) {
    if (!empty($data['color_tax'])) {
      $object->save();
      $set_taxonomy = process_taxonomy_save($object, $data['color_tax'], 'color');
     // How to handle an error so that it gets logged
    }
  }
  return $object;
}
add_filter( 'woocommerce_product_import_pre_insert_product_object', __NAMESPACE__.'\\process_import',

Discussion

pic
Editor guide