WC_Admin_Post_Types::upload_dir()publicWC 1.0

Change upload dir for downloadable files.

{} It's a method of the class: WC_Admin_Post_Types{}

No Hooks.

Return

Array.

Usage

$WC_Admin_Post_Types = new WC_Admin_Post_Types();
$WC_Admin_Post_Types->upload_dir( $pathdata );
$pathdata(array) (required)
Array of paths.

Code of WC_Admin_Post_Types::upload_dir() WC 6.7.0

public function upload_dir( $pathdata ) {
	// phpcs:disable WordPress.Security.NonceVerification.Missing
	if ( isset( $_POST['type'] ) && 'downloadable_product' === $_POST['type'] ) {

		if ( empty( $pathdata['subdir'] ) ) {
			$pathdata['path']   = $pathdata['path'] . '/woocommerce_uploads';
			$pathdata['url']    = $pathdata['url'] . '/woocommerce_uploads';
			$pathdata['subdir'] = '/woocommerce_uploads';
		} else {
			$new_subdir = '/woocommerce_uploads' . $pathdata['subdir'];

			$pathdata['path']   = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['path'] );
			$pathdata['url']    = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['url'] );
			$pathdata['subdir'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['subdir'] );
		}
	}
	return $pathdata;
	// phpcs:enable WordPress.Security.NonceVerification.Missing
}