That's not a bad approach, but I'd probably do this based on an order line property, rather than a bundleId as there will be things in Vendr that assume bundle IDs are for a specific purpose.
We really need to update order lines to expose a parent ID / parent Bundle ID but till then, adding a property to bundle order lines should work such that if there is a specific order line property, return a zero price like you are, otherwise fallback to the default price calculation.
Is the code you have not working? or are you asking if this is an ok approach?
Then yea, for the time being given order lines can't currently identify their parent this should be a good solution.
Moving forward, I'm releasing a v2.1.1 shortly that I've now added ParentOrderLineId and ParentBundleId properties to order lines such that this shouldn't be necessary in future. I'll be releasing this later today.
Orderline price calculator for a Bundle
Question by Paulius Putna
Hi Matt,
I have the opposite question. What if I want to keep the "main" product unit price as it is instead of sum of all sub products?
I have this, with no luck:
public class BundleOrderLineCalculator : OrderLineCalculator { private readonly IStoreService _storeService; private readonly IProductPriceFreezerService _productPriceFreezerService;
Thanks
So you need a bundle order line to be whatever it's unit price is but everything within the bundle to be 0 priced?
Hello Matt, i have the same problem.
"So you need a bundle order line to be whatever it's unit price is but everything within the bundle to be 0 priced?" Yes
Hi @njvicente82
Can you share what code you have tried so far?
Many thanks
Matt
Hi, I implemented a custom IOrderLineCalculator and set a bundle id to the items of the parent bundle, not sure if this is the best approach
public class BundleCalculator : OrderLineCalculator { public BundleCalculator(ITaxService taxService, IStoreService storeService, IProductPriceFreezerService productPriceFreezerService) : base(taxService, storeService, productPriceFreezerService) { }
Hey Neslon,
That's not a bad approach, but I'd probably do this based on an order line property, rather than a
bundleId
as there will be things in Vendr that assume bundle IDs are for a specific purpose.We really need to update order lines to expose a parent ID / parent Bundle ID but till then, adding a property to bundle order lines should work such that if there is a specific order line property, return a zero price like you are, otherwise fallback to the default price calculation.
Is the code you have not working? or are you asking if this is an ok approach?
Hey, Yes, i'm asking if this is an valid approach. Thanks Matt
Hey Nelson,
Then yea, for the time being given order lines can't currently identify their parent this should be a good solution.
Moving forward, I'm releasing a v2.1.1 shortly that I've now added
ParentOrderLineId
andParentBundleId
properties to order lines such that this shouldn't be necessary in future. I'll be releasing this later today.Matt
is working on a reply...