woocommerce_rest_insert_{$this->post_type}_object

woocommerce_rest_insert_{$this->post_type}_object

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

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

do_action('woocommerce_rest_insert_{$this->post_type}_object') is found 2 times:

  • /includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php line 221
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
         * @param WC_Data         $object    Inserted object.
         * @param WP_REST_Request $request   Request object.
         * @param boolean         $creating  True when creating object, false when updating.
         */
        do_action( "woocommerce_rest_insert_{$this->post_type}_object", $object, $request, true );
    } catch ( WC_Data_Exception $e ) {
        $object->delete();
        return new WP_Error( $e->getErrorCode(), $e->getMessage(), $e->getErrorData() );
    } catch ( WC_REST_Exception $e ) {
        $object->delete();
        return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
  • /includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php line 268
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
         * @param WC_Data         $object    Inserted object.
         * @param WP_REST_Request $request   Request object.
         * @param boolean         $creating  True when creating object, false when updating.
         */
        do_action( "woocommerce_rest_insert_{$this->post_type}_object", $object, $request, false );
    } catch ( WC_Data_Exception $e ) {
        return new WP_Error( $e->getErrorCode(), $e->getMessage(), $e->getErrorData() );
    } catch ( WC_REST_Exception $e ) {
        return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
    }

See this hook used in plugins: