Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I was wondering if there is an event for adding a price adjuster? I found one for discount, but I am assuming that dose not include price adjusters.
You mean an event that gets fired when a price adjuster is applied? What's the use case?
We have a API call in the price adjuster. In case that API fails for some reason, we would then like to stop the customer from continuing with the purchase. So I am thinking an event could be the way to go here.
The best option I could think of is to store something in your custom PriceAdjustment that maybe signifies if the API was successful and then write an ValidateOrderSave validation event handler to check for the presence of a PriceAdjustment of your type, with that particular field set. If it is, then prevent the order from being saved?
That could work! I am a bit unsure how I would go about doing it though.. My first thought was to set a custom property to the order depending on the API status. But I don't think that's the way to go about this. Or maybe it is?
What do you think?
When you create a custom PriceAdjuster this will return a custom PriceAdjustment type. On that type you can have whatever properties you like so one of those could be whether the API was successful. You can then lookup price adjustments of that type on the order when you run your validation rule and see if that property is set.
If you checkout the docs here https://vendr.net/docs/core/1.8.0/key-concepts/price-amount-adjustments/#creating-custom-adjustments there is an example of a custom PriceAdjuster that returns a custom PriceAdjustment that has a custom MyAdjustmentRef property.
I will give it a try! Thank you so much Matt!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted