woocommerce_product_object_trashable
Filter whether a product supports trashing in WooCommerce domain abilities.
Usage
add_filter( 'woocommerce_product_object_trashable', 'wp_kama_woocommerce_product_object_trashable_filter', 10, 2 );
/**
* Function for `woocommerce_product_object_trashable` filter-hook.
*
* @param bool $supports_trash Whether the product supports trashing.
* @param \WC_Product $product The product being considered for trashing.
*
* @return bool
*/
function wp_kama_woocommerce_product_object_trashable_filter( $supports_trash, $product ){
// filter...
return $supports_trash;
}
- $supports_trash(true|false)
- Whether the product supports trashing.
- $product(\WC_Product)
- The product being considered for trashing.
Changelog
| Since 10.9.0 | Introduced. |
Where the hook is called
woocommerce_product_object_trashable
woocommerce/src/Internal/Abilities/Domain/ProductDelete.php 102
$supports_trash = apply_filters( 'woocommerce_product_object_trashable', EMPTY_TRASH_DAYS > 0, $product );