Copied to clipboard

Flag this post as spam?

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

  • Philip Hayton 85 posts 411 karma points
    May 06, 2022 @ 11:06
    Philip Hayton

    Order lines are being merged inside a bundle

    Hi Matt,

    I need to add a the same product to a bundle several times inside a loop with each order line having it's own unique set of properties. I expected each iteration to create a unique order line but it's actually merging lines with the same variant reference, and so we're losing the properties that make each order line unique.

    I guess what I need is for properties to be considered part of what makes an order line unique. Is that possible?

    Here's the code for info:

                foreach (var date in model.Dates)
                    // The pricing varies depending on the duration of the service
                    var productVariant = product.Variants.FindByAttributes(new Dictionary<string, string>
                        { Constants.BabySittingService.HoursAttributeAlias, date.NumberOfHours }
                    // Expected this to create a new order line each time, but it's actually merging them when the productVariantReference already exists inside the bundle
                    order.AddProductToBundle(model.BundleId, model.BundleId, productVariant.Content.GetProductReference(), numberOfChildren,
                        new Dictionary<string, string>
                            { Constants.BabySittingService.DatePropertyAlias, date.Date },
                            { Constants.BabySittingService.StartPropertyAlias, date.Start }
  • Matt Brailsford 3872 posts 20650 karma points MVP 9x c-trib
    May 06, 2022 @ 13:15
    Matt Brailsford

    Hi Philip,

    Yup this is possible. You'll want to review the docs on "Product Uniqueness Properties" here

    Ultimately you need to tell Vendr a specific property on the order line that should be considered "unique" and then Vendr will treat each order line that has a distinct value as unique order lines.

    Hope this helps


  • Philip Hayton 85 posts 411 karma points
    May 06, 2022 @ 13:16
    Philip Hayton

    Brilliant! I knew there'd be a way of doing it. Thanks so much for the quick reply 🙏🏻

Please Sign in or register to post replies

Write your reply to: