WooCommerce Code Reference

DeleteProduct
in package

Mutation to delete a product.

Demonstrates: mutation returning bool.

Table of Contents

execute()  : bool
Execute the mutation.

Methods

execute()

Execute the mutation.

public execute(int $id[, bool $force = false ]) : bool
Parameters
$id : int

The product ID.

$force : bool = false

Whether to permanently delete (bypass trash).

Tags
throws
ApiException

When the product is not found.

Return values
boolWhether the product was deleted.