Automattic\WooCommerce\Admin\API

OnboardingTasks::import_sample_products()public staticWC 1.0

Import sample products from WooCommerce sample CSV.

Method of the class: OnboardingTasks{}

No Hooks.

Return

WP_Error|WP_REST_Response.

Usage

$result = OnboardingTasks::import_sample_products();

OnboardingTasks::import_sample_products() code WC 9.0.1

public static function import_sample_products() {
	$sample_csv_file = Features::is_enabled( 'experimental-fashion-sample-products' ) ? WC_ABSPATH . 'sample-data/experimental_fashion_sample_9_products.csv' :
	WC_ABSPATH . 'sample-data/experimental_sample_9_products.csv';

	$import = self::import_sample_products_from_csv( $sample_csv_file );
	return rest_ensure_response( $import );
}