I have ran into a bit of a pickle here. Let's say we have a product that cost 1000 SEK. The customer has 500 SEK in credits. And ontop of that we have a sale for returning that is 20% off the order total.
So we would need the 20% to be calculated on 500 SEK and not 1000 SEK.
But I am having a difficult time getting it to work. I have tried using Amout/Price Adjustments. Pipelines, Calculator & Events. Of what I understand the "native" discounts allways calculates first?
What I have now is 2 adjustments. 1 amount adjustment wich handles the credits. And 1 that gets added from using the discount dashboard in the backoffice. (Wich have the rule. If order has property)
I already have a few orders in the system. And if I just change the current adjusment, it throws a Unable to cast object from amount to price error. Do I just create a new adjuster & keep the old one. Or how should I go about doing this?
Calculate Amount Adjustment first
Hi!
I have ran into a bit of a pickle here. Let's say we have a product that cost 1000 SEK. The customer has 500 SEK in credits. And ontop of that we have a sale for returning that is 20% off the order total.
So we would need the 20% to be calculated on 500 SEK and not 1000 SEK.
But I am having a difficult time getting it to work. I have tried using Amout/Price Adjustments. Pipelines, Calculator & Events. Of what I understand the "native" discounts allways calculates first?
What I have now is 2 adjustments. 1 amount adjustment wich handles the credits. And 1 that gets added from using the discount dashboard in the backoffice. (Wich have the rule. If order has property)
//Johannes
Hi Johannes,
You can control the order of price adjusters at the DI level, injecting your adjuster before the built in
DiscountsPriceAdjuster
like soThis should then ensure that your price adjuster runs before the core adjuster that calculates the discount adjustments.
Hope this helps
Matt
Hi Matt!
That did the trick! Thank you so much!
I already have a few orders in the system. And if I just change the current adjusment, it throws a
Unable to cast object from amount to price
error. Do I just create a new adjuster & keep the old one. Or how should I go about doing this?//Johannes
I'd make sure you are using the right type of adjuster. There are Price Adjusters and Amount Adjusters. You want to be using a Price Adjuster.
Amount Adjusters are adjusters that just apply to the order
TransactionAmount
is working on a reply...