Try our conversational search powered by Generative AI!

Billing info not showing up on order in Commerce Manager



I set the shipping and billing info on my cart.

This is an example of how I set billing info:

var orderAddress = _orderGroupFactory.CreateOrderAddress(cart);

orderAddress.Id = "billing";
orderAddress.Email = "";
orderAddress.FirstName = "John";
orderAddress.LastName = "Doe";

cart.GetFirstForm().Payments.First().BillingAddress = orderAddress;

To finalize this I save the cart.

I can retrieve billing info like:

var billingAddress = cart.GetFirstForm()?.Payments?.FirstOrDefault()?.BillingAddress;

var email = billingAddress?.Email; // This gives me the email ""

Eventually I save the cart as a purchase order.

However when I go to Commerce Manager to look at an order, the "Edit Billing Address" button is disabled, and I don't see the billing info anywhere (except for the id "billing" appearing in Name).

What am I missing here?

Edited, Sep 05, 2018 8:20

If you load your purchase order, is the billing address there. how does it look like in data? 

Sep 05, 2018 8:39

If I run this code to first retrieve the purchaseorder, and then get the billing address:

var purchaseOrder = _orderRepository.Load(orderReference) as IPurchaseOrder;

var billingAddress = purchaseOrder.GetFirstForm().Payments.First().BillingAddress;

then, this is what the billingAddress contains (printed from Visual Studio's Immediate Window):

? billingAddress
City: ""
ConnectionHandler: {EPiServer.ServiceLocation.Injected<Mediachase.Data.Provider.IConnectionStringHandler>}
CountryCode: ""
CountryName: ""
Created: {05-09-2018 07:13:56}
CreatorId: null
DaytimePhoneNumber: ""
DisableSync: false
Email: ""
EveningPhoneNumber: ""
FaxNumber: ""
FieldStorage: Count = 0
FirstName: "John"
Id: 111
LastName: "Doe"
Line1: ""
Line2: ""
MetaClass: {Mediachase.MetaDataPlus.Configurator.MetaClass}
Modified: {05-09-2018 07:13:57}
ModifierId: null
Name: "billing"
ObjectState: Unchanged
OrderGroupAddressId: 111
OrderGroupId: 96
Organization: ""
Parent: {Mediachase.Commerce.Orders.PurchaseOrder}
PostalCode: ""
RegionCode: ""
RegionName: ""
State: ""
SystemFieldStorage: Count = 19

Edited, Sep 05, 2018 9:20

My Commerce is version 11.8.3 by the way.

Sep 05, 2018 10:28

Address is actually the combination of line1, line2, city ... and you address is missing that so that's why it's empty. same goes with the phone number.

Edit billing address button is actually much ... complicated. I am having hard time understand why it is disabled. Perhaps when you add complete address information it will magically ... be enabled?

Sep 05, 2018 11:37

I have tried to set the same address properties on the billing address object, as I do on the shipping object. Specfically I set these properties:


Unfortunately the Edit Billing button remains disabled (for what it's worth, the Edit Shipping button works fine).

Sep 05, 2018 12:28

If in my browser I navigate to the DOM element of the Edit Billing button on the order, and remove the disabled="disabled" attribute, the button is enabled. Interestingly, if I then click the button, a popup shows billing information as expected...

Any chance you can see, in which situation the disabled="disabled" attribute is set on the button?

Edited, Sep 05, 2018 12:46

That's the complicated part I mention about. there is a lot of code to check if you can. or should edit the shipping address ... 

Sep 05, 2018 12:57

Actually it's not that I need to edit the billing address information on the order. It's just that I set the fields email, firstname and lastname from code on the billing address object, and I need to be able to see this information on the order in Commerce Manager. It seems that this information only is viewable if I go into the Edit Billing popup, as I showed in my first post image attachment.

But I guess manually removing the attribute Disabled="Disabled" from the DOM on the Edit Billing button can be a workaround, to get to access the billing information...although it's obviously not very user friendly.

Edited, Sep 05, 2018 13:03

Editing Commerce Manager code is usually not recommended because it could result in painful upgrades if you rely on changing it too much.

Either way, I'm not sure how to solve adding custom data to the string, but I can give a suggestion on how you can control when the button is enabled.

First create an overload of the OrderbillingAddress.OnPreRender()-method (this method is what decides if the button should be enabled or disabled):

using System;
using Mediachase.Commerce.Manager.Apps.Order.CustomPrimitives;

namespace <your namespace>
    public class MyOrderBillingAddress : OrderBillingAddress
        protected override void OnPreRender(EventArgs e)
            btnEditAddress.Disabled = false; // Set this based on whatever you want.

Then "simply" use this control instead of the built in one in your OrderBillingAddress.ascx view in Commerce manager:

// OrderBillingAddress.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrderBillingAddress.ascx.cs" Inherits="<your namespace>.MyOrderBillingAddress" %>

You'll probably have to set some kind of restriction on when it's enabled or not because you may not want the address to be editable all the time (for example when you've processed your payments or when you don't have an address available at all), but hopefully this helps you move forward.

Sep 05, 2018 20:44

Thanks Jafet, that works.

Edited, Sep 06, 2018 7:33

One better option is to file a support ticket so we can properly look into it :).

Sep 06, 2018 7:36

Quan Mai, I will create a support ticket, and refer to this thread. Thanks for your help so far :-)

Edited, Sep 06, 2018 7:58
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.