I write this blog with the below version of the Sitecore.
We know it’s not possible to get all your needs done from out of box features provided by any product, there is always something missing. And fortunately like Sitecore XP, you can also extend the feature of Sitecore XC. In this article, I am going to show you how to have a custom field for the product entity of XC. As it would become too much longer to go I am splitting the complete process into two blogs –
First on Dedicated to XC operation
Second, showing the Extended filed on the actual website
The process in XC is the same for all the entities but you still have to implement the custom logic if you want for any specific business need.
So let’s begin with log in to Sitecore launch pad and open the commerce Business tool, key in the credential for your XC environment as well.
Now Click on the Merchandising icon.
Select the Catalog for which you want to extend the product property. In my case it is Habitat_Master.
Select a category and Sellable item from it, for the purpose of example, I am just selecting a random product as below –
Now click on the Summary block of the sellable item and try to add view. if add view is disabled then you must need to add a new entity version to do this just above the add view click on entity version and add new entity version.
If you have added an entity version make sure that you have selected that new version.
Now you can see add view is enabled to click, then click on that and add a view.
Add property to your newly added view by clicking on options menu add property action. Add Name, Display Name, and Type.
There are only five types are available for our property to select one of them.
After Adding property to your view you can also add some option constraints for your property, which will helpful for editing the property of your view. To add option constraint click on Add Selection Option Constraint from the options menu for this example I am not using the constraint option.
On the edit window, you can add options constraint to your corresponding property. select the property from the drop-down and add options as many you want by click on (+) button.
Edit your view, Now add some actual data to your property by click on edit view from the options menu of your view. select your property
To make this property available for all sellable item we must need to create a template of this property and assign to sellable item entity. to do this click on Make Template action from the options menu of your view and add Name and Display Name for the template on the edit window.
Now you have created the template of your property successfully, it’s time to assign this template to a sellable entity go-to composer tool from Sitecore Experience Commerce dashboard wherein template section your newly created template will be appearing.
Click on your own template and on your template panel there is a Detail block, on its right side there is an option that you can apply on your template. form this option click on Link to Entity action to assign your template to the sellable entity.
After doing this now all the entities of the sellable items will have our new view and property.
Now let’s see how we can use this added property into the XP side.
108000cookie-checkHow to add a Custom property in Sitecore XC Entity – Part 1yes