Commerce

Promotions evaluation on product detail pages

Posted on

Sitecore experience commerce(SXC) imperatively gives you the ability to create promotions to attract website visitors and gain monetary outcomes. The promotions can be configured in SXC in two ways Promotions with Coupons – the customers would need the coupon to get discount or promotion benefit Promotions without Coupons – they are applied automaticaly based on certain criteria like if customer is purchasing three items, give him 10% discount In SXC, these promotions are applied to the shopping cart and are visible to the customer during the checkout process. What if you to indicate your customers about those promotions on product details pages or product search pages? In one of our recent project we had to achieve this. The requirement was to display those promotions on product detail pages which would give customers an idea of what kind of discount they can be offered if they proceed to purchase. Ther were few considerations to […]

Commerce

Updating an order

Posted on

When an order is placed in Sitecore commerce, the order goes to pending status. From pending status, an order can either be released or put on hold. OnHold is an interesting status in Sitecore Commerce. You can make changes to the order while it is on-hold. If you come across a requirement of making changes to an order after it is placed, On-hold status is your best buddy. I had to implement, order updates. The updates were supposed to come from an external system. This is how I approached the whole solution. Pending order minion updates the order status to OnHold after the order goes to that external system. A new Ops API exposed to the external system(the api works just like any other api and expects an auth token). An order update pipeline which updates the order entity. I will mainly share the details of that pipeline here but before I go to the details of […]

Commerce

Managing Stock(inventory) in multiple warehouses

Posted on

OOTB Sitecore Commerce Engine(CE) allows you to have one inventory set for a catalog(products set). There might be situations when multiple warehouses would have the stock for a single product. In such a scenario you can easily extend CE to look for stock in multiple warehouses. When a product is added to the cart, the storefront sends a request to CE to find out if the product is available in stock. CE comes with an API api/GetBulkStockInformation which calls a command GetBulkStockInformationCommand. This command runs IGetSellableItemPipeline to get a sellable item with the availability component.     OOTB CE has PopulateItemAvailabilityComponentBlock which I replaced with PopulateItemAvailabilityComponentFromMultipleWarehousesBlock. In ConfigureSitecore.cs, I added

  While the block PopulateItemAvailabilityComponentFromMultipleWarehousesBlock is inheriting from PopulateItemAvailabilityComponentBlock. In spite of only checking the default inventory set, I am iterating over all the inventory sets to get the stock information. Note: I am calling the inventory sets as warehouses in the code. While passing the names […]

Commerce

Add to cart when there is no price on sellable item- Item is not purchasable

Posted on

There might be a situation when you don’t have any price defined on a sellable item and you still want the ability to Add To Cart. If you are not well across how pricing works in Sitecore Experience Commerce(SXC), please have a look at this article from Andrew Sutherland. In a nutshell, the pricing calculation works from Price Book to List Price. If there are price cards defined on a sellable item, that price is used but if there is no price card, ListPrice defined on a sellable item is used. If your eCommerce website has the option of Contact To Purchase, you might end up having no prices defined(nor price cards neither list price).  In such scenarios, you will get this error  while trying to add to cart Item ‘item name’ is not purchasable. At this stage, you have two options either ask your Content Author to add List Price as $0.00 which […]

Commerce

Adding new conditional logical operators(and/or..) to Promotions Qualifications

Posted on

Promotions: Sitecore Commerce promotions are based on Qualifications and Actions. In this article, I will mainly talk about Qualifications. A qualification is a set of conditions that has to be true for a promotion to be applied to a cart. While each condition represents a Rule in Sitecore world. If you have worked with Rules in Sitecore, it’s the same concept. An example of such a condition would be “Customer is purchasing more than 5 items”. When we define multiple conditions in qualification, we have to add logical condition operators between these conditions. e.g. “Customer is purchasing more than 5 items” And “One of the items in cart is Nike Product“.  OOTB Sitecore Commerce supports two logical operators; And, Or. So the previous example can also be “Customer is purchasing more than 5 items” OR “One of the items in cart is Nike Shirt“ Recently working on a project we had to implement the following examples of qualifications. “Customer is purchasing more than 5 items” And “One of the […]

Commerce

Sitecore Commerce Composer – Important tips for using this powerful business tool

Posted on

Sitecore commerce composer is a really powerful tool to extend the Commerce entities. Recently working on a project I used them quite extensively. Of course, you can still write the code to do the same but the Composer would save you a lot of time. Brief Overview:  The composer is just another business tool of Sitecore Commerce which is used to create Templates using a user-friendly UI. It’s really intuitive. You can read more about it here if you haven’t started using it. A composer template is a collection of properties. Once you create a template using composer, you can link it to different entities or item definitions to extend them.   Few things you should consider before using Composer templates in your projects. Properties Are Required: All the properties that you create would be marked as Required by Sitecore Commerce. This means the content authors would need to fill in the values of all the properties […]

Cake

Build And Package Sitecore Commerce with Cake

Posted on

Cake is really useful for building and packaging .net solutions(both net framework/core). In the world of Sitecore where Helix is the first design choice, Cake can be used to build and package the Sitecore solutions. Habitat sample has cake scripts that can be used to build Sitecore solutions if they follow Helix principles however, Habita sample uses PowerShell scripts for Sitecore Commerce. While working on a Sitecore Commerce project, I decided to write Cake build, here is a list of Tasks I created. You can access the code repository here: https://github.com/isyedakhtar/SitecoreCommerce   Default Task For Local Builds: This task is only for developer’s local machines. It does the following Clean Solution Build Solution Run Sonarq analysis(optional) Publish Commerce Engine Project Copy Published Commerce Engine Project to all Roles Transform Policies – I am using JDT transformation for policies. Replace Variables with actual values in transformed policies Bootstrap Quick-Deploy For Local Builds: This task is also for developer’s local machines. It […]

Commerce

Extending Sitecore Experience Accelerator(SXA) Repositories

Posted on

SXA modules(talking about features mainly) follow the repository pattern. Each api controller depends on a repository to call commerce roles. For example, we have a module Sitecore.Commerce.XA.Feature.Cart which takes care of cart and checkout related operations. There is a CartController which talks to AddToCartRepository for adding a product to the cart.   This repository exposes three methods

While working on a project recently, we had to implement inventory checks for certain products while adding them to the cart. AddLineItmesToCart method doesn’t check for inventory so we decided to overwrite the functionality for this method. In order to extend AddToCartRepository, we created a feature module in our project calling it MyProject.Commerce.XA.Feature.Cart. Since this module extends the Sitecore.Commerce.XA.Feature.Cart module, we added required references to our module. We only wanted to extend the functionality of AddToCartRepository so we created the ExtendedAddToCartRepository class which inherits from AddToCartRepository. And rest was simple C# code 🙂

InventoryManager was required to make the inventory […]

Commerce

Sitecore and Sitecore Commerce – Important Communication Points

Posted on

If you started working with Sitecore commerce 9.0 or later, you might have noticed there are a lot of connection points among different roles of Sitecore XP, solr, Sitecore Identity Server and Sitecore Commerce. It’s important to understand the communication points and how this communication is made secure. Sometimes we face the issues due to wrong configurations of those communication points. Since I went through a bit of pain while configuring Staging and Production environments, I thought to share how communication takes place From Sitecore XP to Commerce Engine(CE) From Commerce Engine to XP(Content Synchronization) Commerce Engine to Solr Commerce Engine Plugins to Sql Bizfx to Commerce Engine Sitecore XP to CE: The communication takes place through Commerce Eninge Connect layer. In Sitecore installation directory(at path App_Config\Include\Y.Commerce.Engine) we have Sitecore.Commerce.Engine.Connect.config which defines the communication configurations from XP to  CE. The configuration defines shopsServiceUrl which is used to send any shops related read/write requests from XP to CE for example, get catalogs […]

Commerce

Sitecore Commerce and Multiple Storefronts – Pitfalls

Posted on

Having multiple storefronts in a Sitecore commerce project is very common. We can create tenants and multiple storefronts. Similarly, we can create multiple catalogs and assign those catalogs to individual storefronts. Recently working with one of the Sitecore Commerce Projects we had to do this kind of implementation. The project started getting interesting when we came across certain requirements e.g. Braintree payment merchant credentials will be different for both Storefronts. Tax rates should be different for both Storefronts etc Now if you look at the storefront settings, we can only set these from the content explorer/commerce control panel. So looking at the documentation of Commerce Engine, we thought Policies are the way to go. Each deployed role can have different policies and behaviors, which can be specified using a specific Commerce Environment for that role. When a call is made to the Commerce Engine, the call’s header specifies an environment. This environment is used by the engine […]