woocommerce_rest_{$this->post_type}_object_trashable

woocommerce_rest_{$this->post_type}_object_trashable

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

apply_filters('woocommerce_rest_{$this->post_type}_object_trashable') is found 3 times:

  • /includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php line 560
    		 *
    		 * @param boolean $supports_trash Whether the object type support trashing.
    		 * @param WC_Data $object         The object being considered for trashing support.
    		 */
    		$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_object_trashable", $supports_trash, $object );
    
    		if ( ! wc_rest_check_post_permissions( $this->post_type, 'delete', $object->get_id() ) ) {
    			return new WP_Error(
    				/* translators: %s: post type */
    				"woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array(
    					'status' => rest_authorization_required_code(),
    
  • /includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php line 1588
    		 *
    		 * @param boolean $supports_trash Whether the object type support trashing.
    		 * @param WC_Data $object         The object being considered for trashing support.
    		 */
    		$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_object_trashable", $supports_trash, $object );
    
    		if ( ! wc_rest_check_post_permissions( $this->post_type, 'delete', $object->get_id() ) ) {
    			return new WP_Error(
    				"woocommerce_rest_user_cannot_delete_{$this->post_type}",
    				/* translators: %s: post type */
    				sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ),
    
  • /includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php line 474
    		 *
    		 * @param boolean $supports_trash Whether the object type support trashing.
    		 * @param WC_Data $object         The object being considered for trashing support.
    		 */
    		$supports_trash = apply_filters( "woocommerce_rest_{$this->post_type}_object_trashable", $supports_trash, $object );
    
    		if ( ! wc_rest_check_post_permissions( $this->post_type, 'delete', $object->get_id() ) ) {
    			/* translators: %s: post type */
    			return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) );
    		}
    
    

See this hook used in plugins: