WC_Admin_Importers::product_importer
The product importer.
This has a custom screen - the Tools > Import item is a placeholder. If we're on that screen, redirect to the custom one.
Method of the class: WC_Admin_Importers{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Admin_Importers = new WC_Admin_Importers(); $WC_Admin_Importers->product_importer();
WC_Admin_Importers::product_importer() WC Admin Importers::product importer code WC 10.5.0
public function product_importer() {
if ( Constants::is_defined( 'WP_LOAD_IMPORTERS' ) ) {
wp_safe_redirect( admin_url( 'edit.php?post_type=product&page=product_importer&source=wordpress-importer' ) );
exit;
}
// phpcs:ignore
if ( isset( $_GET['source'] ) && 'wordpress-importer' === sanitize_text_field( wp_unslash( $_GET['source'] ) ) ) {
wc_admin_record_tracks_event( 'product_importer_view_from_wp_importer' );
}
include_once WC_ABSPATH . 'includes/import/class-wc-product-csv-importer.php';
include_once WC_ABSPATH . 'includes/admin/importers/class-wc-product-csv-importer-controller.php';
$importer = new WC_Product_CSV_Importer_Controller();
$importer->dispatch();
}