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.8.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 563
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    *
     * @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 1593
    1589
    1590
    1591
    1592
    1593
    1594
    1595
    1596
    1597
    1598
    1599
    *
     * @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
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    *
     * @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: