WC_API_Products::upload_product_image( string $image_url )
Upload image from URL
Description Description
Parameters Parameters
- $image_url
-
(Required)
Return Return
(array)
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; }
Changelog Changelog
Version | Description |
---|---|
2.2 | Introduced. |