Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Graham Carr 43 posts 263 karma points c-trib
    Sep 14, 2020 @ 19:50
    Graham Carr
    0

    Member Group Discount Issue

    Hey Matt,

    I am experiencing an issue with a particular type of discount that I am setting up, basically I am creating a discount so that if a member of a particular member group is logged in, and they apply the supplied discount code they get 100% off the order total, see below for setup in backend.

    enter image description here

    The issue during checkout is that if I apply the code on the information page, then the discount does not get applied, it only gets applied "after" I have selected a payment method and landed on the "review" page. If I then step back to the payment method the standard zero value message then appears.

    enter image description here

    At first I thought it was something specific to my solution, but I have tried discount codes that don't involve member groups and the discount is applied fine and shows on the information page as it should as soon as the discount code is submitted.

    Are you able to give this scenario a try and confirm if it is indeed a bug in the checkout process? For your reference I have got the latest version of Vendr 1.2.10 and Vendr Checkout 1.1.5 installed.

    Many thanks,

    Graham

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 15, 2020 @ 08:10
    Matt Brailsford
    0

    Hey Graham,

    The only reason I could think this would happen is if the order isn't assigned to the member. Currently this happens at two points, 1) when the order is created and 2) when the BeginPaymentForm method is called in the review step.

    If your member logged in after the order was created then it wouldn't get assigned to them untill the payment review step, which might explain why it takes them needing to get to the review stage for the discount to apply.

    Does this happen to all orders? ie, if you placed this order, and then started a new one when you know they are definitely logged in and the order is created after they are logged in. Or is it potentially only under this scenario where the order was created prior to login?

    If it is the later, you might need to add something to your login routine that says if the member has a current order when they sign in, then assign the order to that member via order.AssignToCustomer(currentMember.Key.ToString())

    Matt

  • Graham Carr 43 posts 263 karma points c-trib
    Sep 15, 2020 @ 08:43
    Graham Carr
    0

    Hey Matt,

    So this is happening even when an order is created after the member has logged in.

    I think what I am missing is the "order.AssignToCustomer" line as I am just currently creating an order in the standard way.

    Thanks for the heads up, I will give the above a try tonight and let you know if it resolves it (I am sure it will).

    Graham

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 15, 2020 @ 08:45
    Matt Brailsford
    0

    When you say creating an order in the standard way, do you mean via Order.Create or via the sessions managers _sessionManager.GetOrCreateOrder()? If its the later, this should be assigning the member. If it's the former, then yes, you will need to call AssignToCustomer yourself.

    It might be worth tracking the orders order.CustomerInfo.CustomerReference to see whether the order is actually assigned to a member or not. If it's empty, then it's not assigned.

    Matt

  • Graham Carr 43 posts 263 karma points c-trib
    Sep 15, 2020 @ 08:55
    Graham Carr
    0

    Well the code I am to create an order is as follows, so I am using the the _sessionManager.GetOrCreateOrder() way.

    When I get to it tonight I will track the CustomerReference and see if the order is assigned to the member or not when I hit the information page from the basket.

                var linesToAdd = AddToCartMapper.MapFormCollectionToAddToCartDto(model);
    
            try
            {
                foreach (var line in linesToAdd)
                {
                    using (var uow = _unitOfWorkProvider.Create())
                    {
                        var updateOrder = _sessionManager.GetOrCreateCurrentOrder(model.StoreId)
                            .AsWritable(uow)
                            .AddProduct(line.ProductReference, line.Quantity, line.ObjectToDictionary())
                            .SetProperties(new Dictionary<string, string>
                            {
                                { Constants.Properties.Customer.FirstNamePropertyAlias, model.FirstName },
                                { Constants.Properties.Customer.LastNamePropertyAlias, model.LastName },
                                { Constants.Properties.Customer.EmailPropertyAlias, model.EmailAddress },
                                { "billingAddressLine1", model.AddressLine1 },
                                { "billingAddressLine2", model.AddressLine2 },
                                { "billingAddressLine3", model.AddressLine3 },
                                { "billingAddressLine4", model.AddressLine4 },
                                { "billingCity", model.TownCity },
                                { "billingCounty", model.County },
                                { "billingZipCode", model.Postcode },
                                { "billingTelephone", model.PhoneNumber },
                                { "description", "Course Booking" },
                                { "companyName", model.CompanyName},
                                { "jobTitle", model.JobTitle}
                            });
    
                        _orderService.SaveOrder(updateOrder);
    
                        uow.Complete();
                    }
                }
            }
    
  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 15, 2020 @ 08:59
    Matt Brailsford
    0

    Then yea, that should be tracking it.

    Do let me know what you find as if it's nor persisting, that is a bug.

    Matt

  • Graham Carr 43 posts 263 karma points c-trib
    Sep 15, 2020 @ 19:35
    Graham Carr
    0

    Hey Matt,

    So I have given this a try tonight and am outputting

    @currentOrder.CustomerInfo.CustomerReference
    

    on the information page of Vendr checkout and there is no value output, so it is definitely not persisting for some reason.

    I have got around this for now by calling:

    updateOrder.AssignToCustomer(Members.GetCurrentMember().Key.ToString());
    

    just before I save the order when creating it for the first time as was shown in the previous post. I can confirm that now I am calling it manually that the customer reference is set correctly and discounts are applied.

    If you find out what the issue is and create a fix, let me know and I will remove the manual piece of code.

    Graham

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 15, 2020 @ 19:38
    Matt Brailsford
    100

    Strange 🤔

    I’ll take a look tomorrow though and see if I can see what is going on.

    Thanks for confirming and glad we have an interim workaround.

Please Sign in or register to post replies

Write your reply to:

Draft