Redirect ucommerce to external thank you page upon successful checkout

134 Views Asked by At

Existing umbraco/ucommerce store. Upon completion of a successful checkout, I'd like to redirect users to an external URL for the thank you page for tracking purposes -- instead of the default umbraco page, while still making the order confirmation email fire. How do I make this happen?

Current umbraco order confirmation page:

@using xxx.xxx.Ucommerce.Models.ViewModels
@using xxx.xxx.Ucommerce.Utilities;
@using xxx.xxx.Core.Controllers;
@using xxx.xxx.Ucommerce.Controllers;
@using xxx.xxx.Core.Models;
@using UCommerce.Runtime;
@using xxx.HelixLinear.Ucommerce.Models;

@model ConfirmViewModel

@{ 
    var basket = SiteContext.Current.OrderContext.GetBasket();
    var purchaseOrder = basket.PurchaseOrder;
}


<section id="cart" class="section cart">
    <div class="container">
        <div class="row">
            <div class="col-sm-12 m-b-40">
                <h5>Order Confirmation</h5>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="table-responsive">
                    <table class="table table-bordered cart-table">
                        <tbody>
                            <tr>
                                <th class="hidden-xs"></th>
                                <th>Item Description</th>
                                <th>Unit Price</th>
                                <th>Quantity</th>
                                <th>Total</th>
                                <th></th>
                            </tr>
                            @foreach (var orderLine in purchaseOrder.OrderLines)
                            {
                                var product = ProductUtilities.GetProduct(orderLine.Sku);
                                <tr class="cart-row">
                                    <td class="hidden-xs">
                                        <input class="orderLineId" type="hidden" value="@(orderLine.OrderLineId)" />
                                        @if (product.MainImage == null)
                                        {
                                            <img class="img-responsive" src="/images/No_image_available.png" alt="@Html.Raw(product.Name)">
                                        }
                                        else
                                        {
                                            <img src="@product.MainImage.Url" alt="cart-image" alt="@Html.Raw(product.Name)">
                                        }
                                    </td>
                                    <td>
                                        @Html.Raw(orderLine.ProductName)
                                    </td>
                                    <td>[email protected]("0,0.00")</td>
                                    <td>
                                        @(orderLine.Quantity)
                                    </td>
                                    <td>$@(orderLine.Total.Value.ToString("0,0.00"))</td>
                                    <td></td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-xs-5"></div>
            <div class="col-sm-5 col-sm-offset-2">
                <div class="shop-Cart-totalbox">
                    <h5>Order Totals</h5>
                    <table class="table table-striped table-border checkout-table">
                        <tbody>
                            <tr>
                                <th>Subtotal :</th>
                                <td>$@(purchaseOrder.SubTotal == null ? "0.00" : purchaseOrder.SubTotal.Value.ToString("0,0.00"))</td>
                            </tr>
                            <tr>
                                <th>Shipping Total :</th>
                                <td>$@(purchaseOrder.ShippingTotal == null ? "0.00" : purchaseOrder.ShippingTotal.Value.ToString("0,0.00"))</td>
                            </tr>
                            <tr class="shop-Cart-totalprice"><th>Total :</th><td>$@(purchaseOrder.OrderTotal == null ? "0.00" : purchaseOrder.OrderTotal.Value.ToString("0,0.00"))</td></tr>
                        </tbody>
                    </table>
                    @using (Html.BeginUmbracoForm<CheckoutController>("HandleConfirm", null, new { @class = "" }, FormMethod.Post))
                    {
                        @Html.AntiForgeryToken()

                        @Html.HiddenFor(m => m.Email)
                        @Html.HiddenFor(m => m.Name)
                        <button type="submit" class="btn btn-lg btn-block btn-cal-default">
                            <i class="ion-android-cart"></i> Place Order
                        </button>
                    }
                </div>
            </div>
        </div>
    </div>
    
</section>


1

There are 1 best solutions below

0
On

You can actually set an external redirect URL on the Payment Provider, from the backoffice.
You go to Settings > Orders > Payment Methods and then select the one you want.

It looks like this:
Screenshot of Ucommerce backoffice

If you have any further questions, you can direct them to [email protected].
I hope this helps you out.

All the best,
Kamal
Customer Success Agent - .Net developer
Ucommerce.