# Pipelines

Pipelines

# What are the available pipelines

****

****

****

| Class           | Description                                                                                                                                            | Payload                                |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------- |
| CartItemBuilder | The process that occurs when adding an item to the cart. Extending this class allows for manipulation of the cart item before it is saved to the cart. | Aero\Cart\CartItem $item               |
| ContentForHead  | The HTML content that will be inserted into the <head> tag of the page.                                                                                | String $content                        |
| ContentForBody  | The HTML content that will be inserted just before the closing </body> tag of the page.                                                                | String $content                        |
| RobotsTxt       | The robots.txt file. For more information, click here.                                                                                                 | Illuminate\Support\Collection $content |

# How do I extend pipelines?

The payload data can be altered using the **extend()**method. This is typically done from within a **Service Provider**. If the code is unique to a particular store it could be placed in the **boot()**method of the **AppServiceProvider**. If it is to be included as part of a module, then it can be added to the setup method of the module's **Service Provider**.

For example, if a module needs to add an option to items to flag them as requiring gift wrap, the **CartItemBuilder**pipeline class should be extended in the module's **ServiceProvider**as shown below:

```
<?php

namespace Acme\MyModule;

use Aero\Cart\CartItemOption;
use Aero\Common\Providers\ModuleServiceProvider;
use Aero\Store\Pipelines\CartItemBuilder;

class ServiceProvider extends ModuleServiceProvider
{
    public function setup() 
    {
        CartItemBuilder::extend(function ($item) {
            if (request()->has('gift_wrap')) {
                $option = CartItemOption::create('Gift wrap');

                $item->addOption($option);
            }
        });
    }
}

```

To adjust a payload which is a simple string, ensure that the payload variable is passed by reference so that it can be directly modified:

```
\Aero\Store\Pipelines\ContentForHead::extend(function (&$content) {
    $content .= "";

    // or ...

    $content .= view('my_module::script-snippet');
});

```