Automattic\WooCommerce\Admin\API

OnboardingTasks::import_sample_products()public staticWC 1.0

Import sample products from WooCommerce sample CSV.

{} Это метод класса: OnboardingTasks{}

Хуков нет.

Возвращает

WP_Error|WP_REST_Response.

Использование

$result = OnboardingTasks::import_sample_products();

Код OnboardingTasks::import_sample_products() WC 6.9.4

public static function import_sample_products() {
	if (
		( Features::is_enabled( 'experimental-import-products-task' ) || Features::is_enabled( 'experimental-products-task' ) )
		&& static::is_experiment_product_task()
	) {

		$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';
	} else {
		$sample_csv_file = WC_ABSPATH . 'sample-data/sample_products.csv';
	}

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