• Twitter
  • LinkedIn

Sitecore Commerce Engine - Using Commerce Commander

While extending Sitecore Commerce Engine, you often need to call other pipelines and/or commands (For example to find an entity or persist an entity).

Instead of injecting every single pipeline/command in your constructor, you can use Sitecore.Commerce.Core.CommerceCommander .

Let s take this example with a Block that performs these operations:

  1. Calls GetOrderCommand to get the order.
  2. Update the order ContactComponent.
  3. Add Lists to the order using AddLitEntitiesPipeline.
  4. Persist the order using PeristEntityPipeline

Without Commerce Commander the block would look like this:

Let s now write same code using Commerce Commander.

The block would look like this:

As you can see in this example, we only need to inject the CommerceCommander in the constructor, we can then access any registered command/pipeline.

It makes code changes much easier, since you don t need to change your constructor signature to be able to call different/additional pipelines or commands.

For more blogs about Sitecore Experience Commerce, please visit this link. For information on XCentium's Sitecore Commerce services, please click here.

Related Blogs

Latest Blogs