Automattic\WooCommerce\Internal\Admin\ImportExport

CSVUploadHelper::get_import_dirpublicWC 1.0

Returns the full path to the CSV import directory within the uploads folder. It will attempt to create the directory if it doesn't exist.

Method of the class: CSVUploadHelper{}

No Hooks.

Returns

String.

Usage

$CSVUploadHelper = new CSVUploadHelper();
$CSVUploadHelper->get_import_dir( $create ): string;
$create(true|false)
TRUE to attempt to create the directory. FALSE otherwise.
Default: true

CSVUploadHelper::get_import_dir() code WC 9.8.5

public function get_import_dir( bool $create = true ): string {
	$wp_upload_dir = wp_upload_dir( null, $create );
	if ( $wp_upload_dir['error'] ) {
		throw new \Exception( esc_html( $wp_upload_dir['error'] ) );
	}

	$upload_dir = trailingslashit( $wp_upload_dir['basedir'] ) . $this->get_import_subdir_name();
	if ( $create ) {
		FilesystemUtil::mkdir_p_not_indexable( $upload_dir );
	}
	return $upload_dir;
}