I changed the following method in CustomerManager to this:
/// <summary>
/// Reset data required for checkout
/// </summary>
/// <param name="customerId">Customer identifier</param>
/// <param name="clearCouponCodes">A value indicating whether to clear coupon code</param>
/// <param name="clearDefaultBillingAddress">A value indicating whether to clear default billing address</param>
/// <param name="clearDefaultShippingAddress">A value indicating whether to clear default shipping address</param>
public static void ResetCheckoutData(int customerId, bool clearCouponCodes, bool clearDefaultBillingAddress, bool clearDefaultShippingAddress)
{
var customer = GetCustomerById(customerId);
if (customer != null)
{
if (clearDefaultShippingAddress)
customer = SetDefaultShippingAddress(customer.CustomerId, 0);
if (clearDefaultBillingAddress)
customer = SetDefaultBillingAddress(customer.CustomerId, 0);
customer.LastShippingOption = null;
customer = SetLastPaymentMethodId(customer.CustomerId, 0);
customer.UseRewardPointsDuringCheckout = false;
if (clearCouponCodes)
{
customer = ApplyDiscountCouponCode(customer.CustomerId, string.Empty);
customer = ApplyGiftCardCouponCode(customer.CustomerId, string.Empty);
customer = ApplyCheckoutAttributes(customer.CustomerId, string.Empty);
}
}
}
I only see a need to reset billing and shipping address when customer is finished checking out, not when basket is updated etc. So on CheckoutPage use method like this:
//reset checkout data
CustomerManager.ResetCheckoutData(NopContext.Current.User.CustomerId, false,true,true);
on all others set to
//reset checkout data
CustomerManager.ResetCheckoutData(NopContext.Current.User.CustomerId, false,false,false);