Automattic\WooCommerce\Blocks\AIContent

UpdateProducts::reset_products_content()publicWC 1.0

Reset the products content.

Method of the class: UpdateProducts{}

No Hooks.

Return

null. Nothing (null).

Usage

$UpdateProducts = new UpdateProducts();
$UpdateProducts->reset_products_content();

UpdateProducts::reset_products_content() code WC 9.8.1

public function reset_products_content() {
	$dummy_products_to_update = $this->fetch_dummy_products_to_update();
	$i                        = 0;
	foreach ( $dummy_products_to_update as $product ) {
		$image_src        = plugins_url( self::DUMMY_PRODUCTS[ $i ]['image'], dirname( __DIR__, 2 ) );
		$image_alt        = self::DUMMY_PRODUCTS[ $i ]['title'];
		$product_image_id = $this->product_image_upload( $product->get_id(), $image_src, $image_alt );

		$this->product_update( $product, $product_image_id, self::DUMMY_PRODUCTS[ $i ]['title'], self::DUMMY_PRODUCTS[ $i ]['description'], self::DUMMY_PRODUCTS[ $i ]['price'] );

		++$i;
	}
}