Copied to clipboard

Flag this post as spam?

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


  • Sue Taylor 21 posts 102 karma points
    Dec 08, 2022 @ 10:43
    Sue Taylor
    0

    Add a custom pipeline task to add a fee based on the discounted total

    Hi I've got a custom OrderCalculation pipeline task which is add on a 'processing fee' which is based on the total order amount. This works well until I am using discounts, in which case the Calculation object does not have the discounts in it.

    I would like to be able to calculate a processing fee based on the discounted total.

    I believe this is because of where the task is in the pipeline, it is currently configured as shown:

    builder.WithCalculateOrderPricesPipeline().InsertAfter<CalculateOrderTotalPriceWithoutAdjustmentsTask, ProcessingFeesPipelineTask>();
    

    Which task should I insert my custom task after so that I can access the discounts in the Calculation object? I tried a few, but either seem to get into an infinite loop, or dependency injection errors at start up if I don't use the right pipeline/task combination. I am clutching at straws!

    For example, I tried this one which just seemed to get me in an infinite loop.

    builder.WithCalculateOrderAdjustedPricesPipeline().InsertAfter<CalculateOrderTotalPriceWithPreviousAdjustmentsTask, ProcessingFeesPipelineTask>();
    

    I am using vendr 2.4.1 and umbrcao 9 (soon to upgrade) Thanks

    Sue

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Dec 08, 2022 @ 13:57
    Matt Brailsford
    0

    How exactly are you adding the "fee"? As a price adjustment? If not, this is generally how I would suggest you apply fees. Take a look at https://vendr.net/docs/core/3.0.0/key-concepts/price-amount-adjustments/

    Price adjustments should get calculated in the right place so I don't think you would hit this problem.

  • Sue Taylor 21 posts 102 karma points
    Dec 08, 2022 @ 14:34
    Sue Taylor
    0

    I'm adding it as an order line, which I change the amount of in the pipeline task, so feels like a price adjustment would be better.

    Thanks, I'll try this.

Please Sign in or register to post replies

Write your reply to:

Draft