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.8.7.0

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
    		 * @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
    			 * @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
    		 * @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 850
    		 * @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 889
    			 * @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
    		 * @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
    		 * @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: