woocommerce_rest_insert_{$this->post_type}

woocommerce_rest_insert_{$this->post_type}

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}') is found 7 times:

  • /includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php line 333
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    * @param WP_Post         $post      Post object.
     * @param WP_REST_Request $request   Request object.
     * @param boolean         $creating  True when creating item, false when updating.
     */
    do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
    $request->set_param( 'context', 'edit' );
    $response = $this->prepare_item_for_response( $post, $request );
    $response = rest_ensure_response( $response );
    $response->set_status( 201 );
    $response->header( 'Location', rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $post->ID ) ) );
  • /includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php line 372
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
         * @param WP_Post         $post      Post object.
         * @param WP_REST_Request $request   Request object.
         * @param boolean         $creating  True when creating item, false when updating.
         */
        do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
        $request->set_param( 'context', 'edit' );
        $response = $this->prepare_item_for_response( $post, $request );
        return rest_ensure_response( $response );
     
    } catch ( Exception $e ) {
        return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
  • /includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php line 321
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    * @param WP_Post         $post      Post object.
     * @param WP_REST_Request $request   Request object.
     * @param boolean         $creating  True when creating item, false when updating.
     */
    do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
     
    $request->set_param( 'context', 'edit' );
    $response = $this->prepare_item_for_response( $post, $request );
    $response = rest_ensure_response( $response );
    $response->set_status( 201 );
    $response->header( 'Location', rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $post->ID ) ) );
  • /includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php line 853
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    * @param WP_Post         $post      Post object.
     * @param WP_REST_Request $request   Request object.
     * @param boolean         $creating  True when creating item, false when updating.
     */
    do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
    $request->set_param( 'context', 'edit' );
    $response = $this->prepare_item_for_response( $post, $request );
    $response = rest_ensure_response( $response );
    $response->set_status( 201 );
    $response->header( 'Location', rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $post->ID ) ) );
  • /includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php line 892
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
         * @param WP_Post         $post      Post object.
         * @param WP_REST_Request $request   Request object.
         * @param boolean         $creating  True when creating item, false when updating.
         */
        do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
        $request->set_param( 'context', 'edit' );
        $response = $this->prepare_item_for_response( $post, $request );
        return rest_ensure_response( $response );
     
    } catch ( Exception $e ) {
        return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
  • /includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php line 216
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    * @param WP_Post         $post      Post object.
     * @param WP_REST_Request $request   Request object.
     * @param boolean         $creating  True when creating item, false when updating.
     */
    do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, true );
     
    $request->set_param( 'context', 'edit' );
    $response = $this->prepare_item_for_response( $post, $request );
    $response = rest_ensure_response( $response );
    $response->set_status( 201 );
    $response->header( 'Location', rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $post_id ) ) );
  • /includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php line 294
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
         * @param WP_Post         $post      Post object.
         * @param WP_REST_Request $request   Request object.
         * @param boolean         $creating  True when creating item, false when updating.
         */
        do_action( "woocommerce_rest_insert_{$this->post_type}", $post, $request, false );
     
        $request->set_param( 'context', 'edit' );
        $response = $this->prepare_item_for_response( $post, $request );
        return rest_ensure_response( $response );
    }

See this hook used in plugins: