Monday, November 23, 2015

Working with the uCommerce API in Sitecore

uCommerce is a very powerful e-commerce module available for both Sitecore and Umbraco. The API that comes out of the box is equally powerful and have methods which make it possible to import a full product catalog from the third party system. This post will provide example calls into the uCommerce API, which should be everything needed to import data for a full catalog. Many of the methods assume one product catalog (which is a static variable).


Catalog

Each uCommerce shop can have a number of catalogs. The code example below allows you to get a catalog by it's name.


Categories

Below are the methods to get all/single categories, to create a category and to hide a category (set it to not display on web).


Products & Variants

Below are a number of helper methods which include: setting custom properties on products, hiding products, getting product form category and getting a variant from it's parent product.

Then are the actual methods for creating products and variants.

It's worthwhile adding some error handling around this API, especially if the process is done via an automatic sync.

No comments:

Post a Comment