However, for the life of me I can't find this total anywhere: I've tried this:
var model = this.CheckoutPaymentModelFactory.Create(CurrentCustomer, paymentMethod);
model.TotalBasketPriceInPence = Convert.ToInt32(this.Basket.TotalBasketPrice * 100);
But that just returns the total basket value excluding any shipping charge.
Don't mind if it's in a value I then add to my model I pass to the MVC view or set in the MVC view itself.
You want to use the CheckoutManager.Payment.PrepareInvoice() method. Unless you have done a some customizations, the basket will never have a shipping line item. This is due to in many (most) cases, when values in the basket (quantity, items, etc) change the shipping quote needs to be performed again.
The typical workflow works like:
Basket -> Basket.PackageShipments() -> Quote Shipments -> Save quote in checkout manager -> Prepare Invoice -> payment
Basket doesn't seem to have a PackageShipments function?
Where do I go from here:
var shipment = this.Basket.PackageBasket(this.CheckoutManager.Customer.GetShipToAddress());
shipment.FirstOrDefault().???
Should add that this is using FastTrack as a basis. Also, as the Order Summary panel to the right shows the complete total (including shipping) the value should be available somewhere?
Thanks for that - but there's a much easier route if you're using the default FastTrack checkout.
By the time you hit the PaymentForm in the payment provider you've already gone through the Shipping Quote stage so to get the total order cost, including any shipping and taxes you can simply do this:
It really depends how fully your are relying on the checkout workflow. By circumventing the invoice builder you are not doing things like ensuring line times are all tagged with a currency code, applying discounts or calculating taxes on shipping (if that is required).
In fact, if you were relying on taxing the sale like we do in the US, you would not have a tax line item at that point ... and as mentioned the discounts will not be applied.
Probably a bitter approach would be:
var invoice = CheckoutManager.Payment.PrepareInvoice();
var totalCode = invoice.Total;
Get Total (including shipping) in PaymentProvider form
Hi,
I'm trying to get out the total to bill (basket total + shipping) in my payment form. For Stripe, we need to do something like this:
However, for the life of me I can't find this total anywhere: I've tried this:
But that just returns the total basket value excluding any shipping charge.
Don't mind if it's in a value I then add to my model I pass to the MVC view or set in the MVC view itself.
Thanks!
Hey Simon,
You want to use the CheckoutManager.Payment.PrepareInvoice() method. Unless you have done a some customizations, the basket will never have a shipping line item. This is due to in many (most) cases, when values in the basket (quantity, items, etc) change the shipping quote needs to be performed again.
The typical workflow works like:
Basket -> Basket.PackageShipments() -> Quote Shipments -> Save quote in checkout manager -> Prepare Invoice -> payment
Hi Rusty,
Basket doesn't seem to have a PackageShipments function?
Where do I go from here:
Should add that this is using FastTrack as a basis. Also, as the Order Summary panel to the right shows the complete total (including shipping) the value should be available somewhere?
Thanks
You're right - PackageBasket is the one your looking for. On the road today so I was going from memory =)
So I don't misquote again - there is an extension of of the shipment ... but checkout the FastTrack code here https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Web/Factories/CheckoutShipRateQuoteModelFactory.cs#L65
Hi Rusty,
Thanks for that - but there's a much easier route if you're using the default FastTrack checkout.
By the time you hit the
PaymentForm
in the payment provider you've already gone through the Shipping Quote stage so to get the total order cost, including any shipping and taxes you can simply do this:Rusty - any problems you can see with this shortcut?
Thanks
Hi Simon,
It really depends how fully your are relying on the checkout workflow. By circumventing the invoice builder you are not doing things like ensuring line times are all tagged with a currency code, applying discounts or calculating taxes on shipping (if that is required).
In fact, if you were relying on taxing the sale like we do in the US, you would not have a tax line item at that point ... and as mentioned the discounts will not be applied.
Probably a bitter approach would be:
is working on a reply...