woocommerce_before_delete_order_item

woocommerce_before_delete_order_item

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

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

do_action('woocommerce_before_delete_order_item') is found 2 times:

  • /includes/data-stores/abstract-wc-order-item-type-data-store.php line 140
    	 */
    	public function delete( &$item, $args = array() ) {
    		if ( $item->get_id() ) {
    			global $wpdb;
    			do_action( 'woocommerce_before_delete_order_item', $item->get_id() );
    			$wpdb->delete( $wpdb->prefix . 'woocommerce_order_items', array( 'order_item_id' => $item->get_id() ) );
    			$wpdb->delete( $wpdb->prefix . 'woocommerce_order_itemmeta', array( 'order_item_id' => $item->get_id() ) );
    			do_action( 'woocommerce_delete_order_item', $item->get_id() );
    			$this->clear_cache( $item );
    		}
    	}
    
  • /includes/wc-order-item-functions.php line 84
    	}
    
    	$data_store = WC_Data_Store::load( 'order-item' );
    
    	do_action( 'woocommerce_before_delete_order_item', $item_id );
    
    	$data_store->delete_order_item( $item_id );
    
    	do_action( 'woocommerce_delete_order_item', $item_id );
    
    	return true;
    

See this hook used in plugins: