WC_Product::delete()publicWC 1.0

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

{} It's a 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

Code of WC_Product::delete() WC 6.8.2

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;
}