It is often said, Sitecore Commerce (XC) an extensible platform. The extensibility offered by the platform is due to the plugin-based architecture it provides.
What is a plugin? Simply put all commerce features are delivered using plugins. A plugin is
- Primary means to customise and extend Commerce functionality
- Built on the principle of compositional extensibility and opt-in complexity
- Importantly, plugins allow you to create a robust solution which is upgradeable, flexible, reusable with a clear separation on concerns.
- When adding a new feature or modifying an existing feature do not change any OOTB plugins instead create your own plugin or inject new blocks into existing plugins.
What goes inside a plugin
Among a lot of things which a plugin uses, a plugin consists of pipelines and blocks. The Sitecore Commerce Core uses a pipeline-based framework based on.NET Core Dependency Injection, enabling extensibility and offering flexibility.
These pipelines –
- Acts as a container for business logic, like what we have in XP.
- Have blocks implementing the business logic akin to processors in XP.
- Or blocks can call other pipelines and blocks – Think about the separation of concerns, also be mindful that OOTB these plugins refer to other plugins all the time
And the good news is there are no XML files to juggle with, use Configure.Sitecore class to register pipeline and blocks.
How to view the running pipelines
You can view the running pipeline via the following two ways–
- GetRegisteredPipeline postman call -> Under Ops collection
2. Environment Nodeconfiguration log
The pipeline framework offers the tracing capabilities. This is helpful in monitoring and troubleshooting pipelines. It can be enabled in commerce configs at –
The project template provided as the part of the SDK includes a ConfigureSitecore class inheriting the interface IConfigureSitecore. In this class in ConfigureServices function, you can define your custom pipelines.
addpipeline method to add new pipelines
Once you have configured a new pipeline or want to amend a pipeline, you can –
- Add a new block into a new pipeline
- You can add a block before/after an existing block
- You can replace a block from an existing pipeline – overriding OOTB functionality
- Or you can remove a block from a pipeline
I hope this blog provides a high-level understanding of the XC’s pipeline model. Please let me know in the comments.