﻿![]()

#### 

In my previous [blog post](https://www.brimit.com/blog/sitecore-commerce-9-export-catalogs-under-the-hood), I explained how the Catalogs Export works under the hood. Now I'll show how the export process can be implemented for Price Books or any other custom entities in Sitecore Commerce.

You can find  the source code here: [https://github.com/Frog911/Sitecore.Commerce.ImportExport](https://github.com/Frog911/Sitecore.Commerce.ImportExport)

First, we have to create ApiController and ExportPriceBooks action. The action will support several parameters like filename, mode, and maximumItemsPerFile.

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/1.png?w=900&amp;hash=25508D6389FB7DAEF0E1BF4B6255BD9D)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/1.png)

Let’s create ExportPriceBooksCommand. The command will look like this:

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/2.png?w=900&amp;hash=C082AE01199F5B390041C2100554B236)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/2.png)

We have to create a custom argument for the pipeline, which we will create a bit later.

 ExportPriceBooksArgument will be used by pipeline and pipeline blocks to share some data through the blocks.

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/3.png?w=900&amp;hash=D645D402507CFD539AA5FA18B3704CA9)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/3.png)

Now we can create our pipeline interface and implement this interface:

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/31.png?w=900&amp;hash=F69B0AC7ABED7A1C33971B3435965A60)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/31.png)

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/4.png?w=900&amp;hash=F83C8C5A20E68B9E418890EB93B549E4)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/4.png)

We have created a pipeline, so now we can focus on block implementation.

 Let’s create ExportPriceBookBlock. The source code for this block should look like below:

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/5.png?w=900&amp;hash=B2EACCBC6E57B3D310CB00CA2105B4A6)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/5.png)

As you can see, it is required to create a new IStreamPriceBooksToArchivePipeline and implement this interface.

 Let’s create them!

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/6.png?w=900&amp;hash=E6D1E81C0C3474A211DD9EEA908FEA29)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/6.png)

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/7.png?w=900&amp;hash=B8DAF1B48B9DF88F16B431AC207EA910)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/7.png)

Now we are going to create three custom blocks for this pipeline:

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/9.png?w=900&amp;hash=9F1DFBDB2EF307D060A862FA58741922)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/9.png)

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/8.png?w=900&amp;hash=71A3956A24A46F0FE6E98CBAA0817830)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/8.png)

StreamPriceBooksToArchiveBlock is responsible to export PriceBook entities. We have to override the virtual method from the base class and set the type of entity, which we have to export. In this case, it is a PriceBook entity. You can use your custom entity type if you want to export your custom entities.

In the last block, we have to export PriceCards. The implementation will look like below:

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/10.png?w=900&amp;hash=FBE76DAEE2F3B64D57241133A09DD5B2)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/10.png)

We need to register the endpoint, which we have created at the beginning.

The last step is registering all pipelines and blocks in ConfigureSitecore.cs:

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/11.png?w=900&amp;hash=A43C822C8E928F5C7FCED3511BE40029)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/11.png)

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/12.png?w=900&amp;hash=3306DA9BAEAE26AF3D176A1EA432C3A8)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/12.png)

Now everything is ready for the test.

We can create a Postman request to call our custom endpoint.

[![Sitecore Commerce 9: Export Price Books](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/13.png?w=900&amp;hash=F97C79955AF11FFE41272F30D0FA761B)](https://www.brimit.com/-/media/project/brimit/blog/2020/apaliakou/post-2/13.png)

The Price Book Export works fine. We are able to save the archive with the exported data.

 In the next [blog post](https://www.brimit.com/blog/sitecore-commerce-9-import-price-books), I will explain how to import this exported ZIP file to Sitecore Commerce.

Stay tuned!

###### More from author

[##### Sitecore OrderCloud: Restricting access to a custom middleware endpoints for Anonymous customers
August 13, 2024](https://www.brimit.com/blog/sitecore-ordercloud-restricting-access-to-custom-middleware-endpoints-for-anonymous-customers)[##### Sitecore OrderCloud: Cannot Create a Buyer and a Supplier with the Same ID
March 31, 2023](https://www.brimit.com/blog/sitecore-ordercloud-cannot-create-a-buyer-and-a-supplier-with-the-same-id)[##### Sitecore OrderCloud: How to Start Using “Me and My Stuff”
November 29, 2021](https://www.brimit.com/blog/sitecore-ordercloud-how-to-start-using-me-and-my-stuff)

###### Author

[!\[apaliakou\](https://www.brimit.com/-/jssmedia/feature/blogs/authors/apaliakou.jpg?h=216&amp;iar=0&amp;w=360&amp;hash=5BE96F17AE5B47F66D9F684B87773675)
Andrei Paliakou
Sitecore MVP/ Lead Developer](https://www.brimit.com/blog/author?authors=Andrei%20Paliakou)

###### More By Categories

[#How-to](https://www.brimit.com/blog?categories=#How-to)

###### More by Platform

[Data and AI](https://www.brimit.com/blog?platforms=Data%20and%20AI)[DXP](https://www.brimit.com/blog?platforms=DXP)[E-commerce](https://www.brimit.com/blog?platforms=E-commerce)[Internet of Things](https://www.brimit.com/blog?platforms=Internet%20of%20Things)[Sales and marketing automation](https://www.brimit.com/blog?platforms=Sales%20and%20marketing%20automation)

#### More on Sitecore

[!\[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2024/vercel_cover-image.png)
#Guides#How-toDXPE-commerce
##### How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects
Optimize and accelerate the development and deployment of complex multisite Sitecore projects.
Alexei Vershalovich on July 17, 2024](https://www.brimit.com/blog/how-vercel-will-help-you-save-effort-when-deploying-sophisticated-sitecore-projects)

[!\[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2023/sitecore-mentoring---cover-image.png)
#How-toDXP
##### Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story
How to participate in the Sitecore Mentor program and help younger colleagues jump-start a career in Sitecore development.
Sergey Baranov on October 2, 2023](https://www.brimit.com/blog/training-up-tomorrows-sitecore-mvps)

[!\[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2022/headless/adobestock_456986731.jpg)
#How-toDXPE-commerce
##### Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)
Discover how a headless CMS can benefit organizations that use Sitecore.
Daniil Raschupkin, Palina Trokhautsava on September 15, 2022](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)

![](https://bat.bing.net/action/0?ti=187017043&amp;tm=gtm002&amp;Ver=2&amp;mid=c416c5e0-0405-4736-ae1e-0515122d5ad5&amp;bo=2&amp;gtm_tag_source=1&amp;pi=0&amp;lg=en-US&amp;sw=800&amp;sh=600&amp;sc=24&amp;nwd=1&amp;tl=Sitecore%20Commerce%209%3A%20Exporting%20Price%20Books&amp;p=https%3A%2F%2Fwww.brimit.com%2Fblog%2Fsitecore-commerce-9-export-price-books&amp;r=&amp;lt=331&amp;evt=pageLoad&amp;sv=2&amp;asc=D&amp;cdb=AQAY&amp;rn=49862)