Skip to main content
The order creation process can be customized using pipelines.

Overview

If you want to add additional functionality to the Order creation process, you can do so using pipelines.

Pipelines

Adding an Order Pipeline

All pipelines are defined in config/lunar/orders.php
'pipelines' => [
    'creation' => [
        Lunar\Pipelines\Order\Creation\FillOrderFromCart::class,
        Lunar\Pipelines\Order\Creation\CreateOrderLines::class,
        Lunar\Pipelines\Order\Creation\CreateOrderAddresses::class,
        Lunar\Pipelines\Order\Creation\CreateShippingLine::class,
        Lunar\Pipelines\Order\Creation\CleanUpOrderLines::class,
        Lunar\Pipelines\Order\Creation\MapDiscountBreakdown::class,
        // ...
    ],
],
You can add your own pipelines to the configuration, they might look something like:
<?php

namespace App\Pipelines\Orders;

use Closure;
use Lunar\Models\Contracts\Order;

class CustomOrderPipeline
{
    public function handle(Order $order, Closure $next): mixed
    {
        // Do something to the order...

        return $next($order);
    }
}
'pipelines' => [
    'creation' => [
        // ...
        App\Pipelines\Orders\CustomOrderPipeline::class,
    ],   
],
Pipelines will run from top to bottom