WC_API_Products::upload_product_image( string $image_url )

Upload image from URL


Description Description


Parameters Parameters

$image_url

(Required)


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/legacy/api/v2/class-wc-api-products.php

	public function upload_product_image( $image_url ) {
		$upload = wc_rest_upload_image_from_url( $image_url );
		if ( is_wp_error( $upload ) ) {
			throw new WC_API_Exception( 'woocommerce_api_product_image_upload_error', $upload->get_error_message(), 400 );
		}

		return $upload;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.2 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.