To integrate the WooCommerce built-in product CSV importer with other plugins, you can use the following hooks:
1. `woocommerce_product_importer_parsed_data_product`: This filter allows you to modify the parsed data for a product before it is imported. You can use this hook to add or modify data from other plugins.
php
add_filter( 'woocommerce_product_importer_parsed_data_product', 'modify_product_data', 10, 2 );
function modify_product_data( $parsed_data, $raw_data ) {
// Modify $parsed_data based on data from other plugins
return $parsed_data;
}
2. `woocommerce_product_import_pre_insert_product_object`: This action is triggered before a product object is inserted or updated during the import process. You can use this hook to perform additional actions or modify the product object.
php
add_action( 'woocommerce_product_import_pre_insert_product_object', 'pre_insert_product_actions', 10, 2 );
function pre_insert_product_actions( $product, $data ) {
// Perform additional actions or modify the product object
}
3. `woocommerce_product_import_inserted_product_object`: This action is triggered after a product object is inserted or updated during the import process. You can use this hook to perform additional actions or update data in other plugins.
php
add_action( 'woocommerce_product_import_inserted_product_object', 'post_insert_product_actions', 10, 2 );
function post_insert_product_actions( $product, $data ) {
// Perform additional actions or update data in other plugins
}
4. `woocommerce_product_importer_mapping_options`: This filter allows you to modify the mapping options for the importer. You can use this hook to add or modify mapping options for custom fields or taxonomies.
php
add_filter( 'woocommerce_product_importer_mapping_options', 'modify_importer_mapping_options' );
function modify_importer_mapping_options( $options ) {
// Modify $options to add or modify mapping options
return $options;
}
By using these hooks, you can integrate the WooCommerce product CSV importer with other plugins and perform additional actions or modify data during the import process[1][5].
Citations:[1] https://woocommerce.com/document/product-csv-importer-exporter/
[2] https://woocommerce.com/document/webhooks/
[3] https://www.webtoffee.com/setting-up-product-import-export-plugin-for-woocommerce/
[4] https://www.codeable.io/blog/import-products-into-woocommerce/
[5] https://github.com/woocommerce/woocommerce/wiki/Product-CSV-Importer-%26-Exporter