woocommerce_rest_(post_type)_object_trashable
Filter whether an object is trashable.
Return false to disable trash support for the object.
Usage
add_filter( 'woocommerce_rest_(post_type)_object_trashable', 'wp_kama_woocommerce_rest_post_type_object_trashable_filter', 10, 2 );
/**
* Function for `woocommerce_rest_(post_type)_object_trashable` filter-hook.
*
* @param boolean $supports_trash Whether the object type support trashing.
* @param WC_Data $object The object being considered for trashing support.
*
* @return boolean
*/
function wp_kama_woocommerce_rest_post_type_object_trashable_filter( $supports_trash, $object ){
// filter...
return $supports_trash;
}
- $supports_trash(true|false)
- Whether the object type support trashing.
- $object(WC_Data)
- The object being considered for trashing support.
Where the hook is called
woocommerce_rest_(post_type)_object_trashable
woocommerce_rest_(post_type)_object_trashable
woocommerce_rest_(post_type)_object_trashable
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php 475
$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_object_trashable", $supports_trash, $object );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php 1735
$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_object_trashable", $supports_trash, $object );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php 622
$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_object_trashable", $supports_trash, $object );
Where the hook is used in WooCommerce
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php 57
add_filter( "woocommerce_rest_{$this->post_type}_object_trashable", '__return_false' );