WC_Helper_Order::delete_order PHP Méthode

delete_order() public static méthode

Delete a product.
public static delete_order ( integer $order_id )
$order_id integer ID of the order to delete.
    public static function delete_order($order_id)
    {
        $order = wc_get_order($order_id);
        // Delete all products in the order
        foreach ($order->get_items() as $item) {
            WC_Helper_Product::delete_product($item['product_id']);
        }
        WC_Helper_Shipping::delete_simple_flat_rate();
        // Delete the order post
        wp_delete_post($order_id, true);
    }