DEV Community


Posted on

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

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'])) {
      $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',

Top comments (0)

An Animated Guide to Node.js Event Loop

>> Check out this classic DEV post <<