WC_Admin_Addons::fetch_product_preview
Fetch markup and other info for the preview of a product.
Method of the class: WC_Admin_Addons{}
No Hooks.
Returns
Array|WP_Error. Preview data or error object.
Usage
$result = WC_Admin_Addons::fetch_product_preview( $product_id );
- $product_id(int) (required)
- The ID of the product to fetch preview for.
WC_Admin_Addons::fetch_product_preview() WC Admin Addons::fetch product preview code WC 10.3.3
public static function fetch_product_preview( int $product_id ) {
$url = 'https://woocommerce.com/wp-json/wccom-extensions/1.0/product-previews?product_id=' . $product_id;
$fetch_options = array(
'locale' => true,
);
$raw_preview = self::fetch( $url, $fetch_options );
return self::process_api_response( $raw_preview, 'product preview', true );
}