1

I have created a Commerce order using the Sitecore Commerce Connect OrderServiceProvider and I can see the order details in the Order Section of the Sitecore Commerce Business Tool

var orderService = new OrderServiceProvider();
var request = new SubmitVisitorOrderRequest(cart);
var result = orderService.SubmitVisitorOrder(request);

enter image description here

The order itself works fine, but the problem I have is that the order is not linked or displayed in the Customer Section as shown in the image below. enter image description here

The Customer Entity ID looks to be matching, but I am not sure why it does not reflect in the Customer Section. Also, the order is not reflected in the Sitecore Experience Profile as well.

enter image description here

What is the correct way to create an order that is integrated to the Customer Section and Experience profile? Thanks in advance.

3

The reason is that the isRegistered header value must be set to true, otherwise the CustomerId will just be act as a text string reference instead of referencing to an actual customer.

More information on Sitecore Service API Headers

In Sitecore Commerce Connect Service Layer, the IsRegistered header value is set in Sitecore.Commerce.Engine.Connect.EngineConnectUtility and the value will be based on Context.User.IsAuthenticated

public static Container GetShopsContainer(string environment = "", string shopName = "", string userId = "", string customerId = "", string language = "", string currency = "", DateTime? effectiveDate = null)
{
    (DataServiceContext)container).add_BuildingRequest((object s, BuildingRequestEventArgs e) => {
        if (Context.User != null)
        {
            e.get_Headers().Add("IsRegistered", Context.User.IsAuthenticated.ToString(CultureInfo.InvariantCulture));
        }
    });
    return container;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.