Gift card object inside the OrderReadOnly doesn't contain amount in the new vesion. also, TotalPrice object doesn't contain the GiftCardsAmount. How to solve this?
2) How to implement the price adjustment? Previously, I implemented the discount using
If you haven't already I would urge you to read the blog post we wrote on the 1.4.0 RC (which is still relevant) that documents all the changes around "Adjustments" https://vendr.net/blog/vendr-1-4-0-release-candidate/
Thank you for the documents you've shared. Appreciate it.
Another question,
I already created the custom amount adjuster.
My question is how can I apply the custom amount adjuster?
In the documentation, it is written "Adjustments are applied using a IPriceAdjuster or IAmountAdjuster ...". I accessed the ApplyAmountAdjustments method from IAmountAdjuster but the method requires the AmountAdjusterArgs param. How can I get the AmountAdjusterArgs?
You don't create the AdjusterArgs yourself, rather this is passed into you custom adjuster by Vendr.
There is an example adjuster in the docs
public class MyPriceAdjuster : PriceAdjusterBase
{
public override void ApplyPriceAdjustments(PriceAdjusterArgs args)
{
// Calculate Adjustment
// Discount adjustments should be negative in
// where as Fee adjustments should be positive
// Create a £10 discount
var price = new Price(-8.33, -1.67, args.Order.CurrencyId);
var adjustment = new MyAdjustment("My Discount", "MD-001", price);
// Add the adjustment to the sub total price
args.SubtotalPriceAdjustments.Add(adjustment);
}
}
So you create your own Adjuster, which is passed the AdjusterArgs by Vendr and then you modify the args, adding your custom adjustment (that you instantiate in your adjuster) to the list of adjusters for the price you wish to modify.
Once you have your adjuster + adjustment defined, you then register the adjuster so that it is known to Vendr
[ComposeAfter(typeof(VendrWebComposer))]
public class MyComposer : IUserComposer
{
public void Compose(Composition composition)
{
composition.WithPriceAdjusters()
.Append<MyPriceAdjuster>();
}
}
All registered adjusters are executed whenever an order is recalculated. In your adjuster you need to decide whether the adjustment should be applied or not and if it is, create your adjustment and apply it to whever price you want adjusted.
For your use case, where the adjustment is applied based on a user interaction you'll probably want to do something like have the buttons store a property on the order and then in your adjuster check that property to see if it's Value A, in which case apply Adjustment A or if it is Value B in which case apply Adjustment B.
If you implemented a discount previously, it shouldn't be that different, you still run on every order calculation and you decide whether to apply an adjustment or not. It's just adjustments can be positive (fees) or negative (discounts) unlike the previous functionality which was discounts only.
I've upgraded my Vendr.Chcekout to v1.2.0 (*note: Vendr v1.4.2).
I adjusted the transaction amount to 0. Then I got this error when I want to continue the checkout process. Do you know how to fix this? Thanks
Looking back at the changelog, it looks like there was a bug where the Zero Value Payment Provider wasn't updated in the 1.4.x release to use the new TransactionAmount property so it's erroring because it's using the Order.TotalPrice property still which won't be zero.
This was fixed though in 1.5.2 https://vendr.net/docs/core/changelog/#v152 so I'd recommend upgrading to that version. Unfortunately 1.5.x requires an Umbraco version bump to 8.10.x due to it containing the new Variants Property Editor which is based on the block list editor that was introduced in 8.10.
If you are going to upgrade, I would probably suggest the best thing to do would just be to upgrade to the latest of Vendr and Umbraco.
Matt
PS Can you try and keep forum posts to one topic at a time please. This really should have been raised as a separate topic.
Vendr deprecated function issues after version upgraded from 1.3.2 to 1.4.2
Hi,
I upgraded the Vendr version to 1.4.2 previously version 1.3.2. There are several deprecated functions.
I want to validate that the changed that I did is solved the deprecated function issues.
1) WithoutDiscounts >> WithoutAdjustments
Deprecated :
New :
I also want to ask how to solve these deprecated issues,
1) Gift card
Previously, to display the gift card code and amount in the summary page, the code is like this
Gift card object inside the OrderReadOnly doesn't contain amount in the new vesion. also, TotalPrice object doesn't contain the GiftCardsAmount. How to solve this?
2) How to implement the price adjustment? Previously, I implemented the discount using
Thanks.
Hi Nalysa,
If you haven't already I would urge you to read the blog post we wrote on the 1.4.0 RC (which is still relevant) that documents all the changes around "Adjustments" https://vendr.net/blog/vendr-1-4-0-release-candidate/
In addition, I'd suggest reviewing the demo store order summary view ( https://github.com/vendrhub/vendr-demo-store/blob/main/src/Vendr.DemoStore.Web/Views/CheckoutStepPage.cshtml ) to see how we are fetching things like GiftCards to display on the order summary screen ( https://github.com/vendrhub/vendr-demo-store/blob/main/src/Vendr.DemoStore.Web/Views/CheckoutStepPage.cshtml#L122 )
Lastly, you can find documentation about how to implement a price adjustment on the Vendr docs site at https://vendr.net/docs/core/1.7.0/key-concepts/price-amount-adjustments/
Hope this helps
Matt
Hi Matt
Thank you for the documents you've shared. Appreciate it.
Another question, I already created the custom amount adjuster. My question is how can I apply the custom amount adjuster?
In the documentation, it is written "Adjustments are applied using a
IPriceAdjuster
orIAmountAdjuster
...". I accessed theApplyAmountAdjustments
method fromIAmountAdjuster
but the method requires theAmountAdjusterArgs
param. How can I get theAmountAdjusterArgs
?Thanks
Hi Nalysa,
You don't create the AdjusterArgs yourself, rather this is passed into you custom adjuster by Vendr.
There is an example adjuster in the docs
So you create your own Adjuster, which is passed the AdjusterArgs by Vendr and then you modify the args, adding your custom adjustment (that you instantiate in your adjuster) to the list of adjusters for the price you wish to modify.
Once you have your adjuster + adjustment defined, you then register the adjuster so that it is known to Vendr
Each of these steps is detailed on the docs page here https://vendr.net/docs/core/1.7.0/key-concepts/price-amount-adjustments/
Matt
Hi Matt,
I've followed the documentation you gave. I already created the adjuster and adjustment.
I still don't really understand how this adjuster works. I will explain my question with some example, maybe it helps to make my question clear.
For example, I created Adjuster A + Adjustment A and I create another one, Adjuster B + Adjustment B.
When the user clicks button 1, it triggers the Adjuster A.
When the user clicks button 2, it triggers the Adjuster B.
How can I achieve those behavior?
Thank you.
Hi Nalysa,
All registered adjusters are executed whenever an order is recalculated. In your adjuster you need to decide whether the adjustment should be applied or not and if it is, create your adjustment and apply it to whever price you want adjusted.
For your use case, where the adjustment is applied based on a user interaction you'll probably want to do something like have the buttons store a property on the order and then in your adjuster check that property to see if it's Value A, in which case apply Adjustment A or if it is Value B in which case apply Adjustment B.
If you implemented a discount previously, it shouldn't be that different, you still run on every order calculation and you decide whether to apply an adjustment or not. It's just adjustments can be positive (fees) or negative (discounts) unlike the previous functionality which was discounts only.
Hope this helps clarify
Matt
Hi Matt,
Thank you for your clarification and explanation, appreciate it.
Hi Matt,
I've upgraded my Vendr.Chcekout to v1.2.0 (*note: Vendr v1.4.2). I adjusted the transaction amount to 0. Then I got this error when I want to continue the checkout process. Do you know how to fix this? Thanks
Hi Nalya,
Looking back at the changelog, it looks like there was a bug where the Zero Value Payment Provider wasn't updated in the 1.4.x release to use the new TransactionAmount property so it's erroring because it's using the Order.TotalPrice property still which won't be zero.
This was fixed though in 1.5.2 https://vendr.net/docs/core/changelog/#v152 so I'd recommend upgrading to that version. Unfortunately 1.5.x requires an Umbraco version bump to 8.10.x due to it containing the new Variants Property Editor which is based on the block list editor that was introduced in 8.10.
If you are going to upgrade, I would probably suggest the best thing to do would just be to upgrade to the latest of Vendr and Umbraco.
Matt
PS Can you try and keep forum posts to one topic at a time please. This really should have been raised as a separate topic.
Hi Matt,
Thank you for you explanation.
is working on a reply...