I followed the instructions to create a plugin in nop4.6 for an Extra Fee.
I am now using this block of code everywhere to update the total.
Please advise on how to update the final total so it can reflect everywhere from the Plugin, just like the UPS Shipping Plugin, which I looked at and tried to follow for my own plugin.
Any ideas on how to get that done?
var store = await _storeContext.GetCurrentStoreAsync();
var cart = await _shoppingCartService.GetShoppingCartAsync(await _workContext.GetCurrentCustomerAsync(), ShoppingCartType.ShoppingCart, store.Id);
var pickUpPoint = await _genericAttributeService.GetAttributeAsync<PickupPoint>(customer, NopCustomerDefaults.SelectedPickupPointAttribute, store.Id);
var orderTotal = (int)(paymentRequest.OrderTotal * 100);
Address shipAdd = await _customerService.GetCustomerShippingAddressAsync(customer);
if (pickUpPoint.Id != null)
{
if (!pickUpPoint.Id.Equals("18"))
{
if (orderTotal < 2500)
{
orderTotal += 300;
}
}
}
else
{
if (shipAdd != null)
{
if (shipAdd.StateProvinceId != 41)
{
var orderItemQuant = 0;
foreach (var item in cart)
{ orderItemQuant += item.Quantity; }
if (orderItemQuant <= 12)
{ orderTotal += 5400; }
else
{ orderTotal += 6000; }
}
}
}