WC_Product::delete()publicWC 1.0

Delete the product, set its ID to 0, and return result.

Method of the class: WC_Product{}

No Hooks.

Return

true|false. result

Usage

$WC_Product = new WC_Product();
$WC_Product->delete( $force_delete );
$force_delete(true|false)
Should the product be deleted permanently.
Default: false

WC_Product::delete() code WC 8.7.0

public function delete( $force_delete = false ) {
	$product_id = $this->get_id();
	$deleted    = parent::delete( $force_delete );

	if ( $deleted ) {
		$this->maybe_defer_product_sync();
		wc_get_container()->get( ProductAttributesLookupDataStore::class )->on_product_deleted( $product_id );
	}

	return $deleted;
}