When consumers checkout and they have insufficient funds, the wrong billing address or a variety of other reasons that results in an error in their transactions the user is sent to the Shopify error page. If you wish to host the error page yourself to keep the user on your domain follow these instructions:
Edit page.shopifyError.liquid, replace the content of this page with that of page.shopifyRedirect.liquid then change the redirect function to point to your error page. You will need to pass the value of the id query param from this page to your error page. There is also a POST request to '/cart/clear.js' that should be removed.
-
The end result should have a script block like the following. The commented lines are only there to illustrate differences from the original source.
<script type="text/javascript">
(function() {
doWithJQuery(function($) {
$(function() {
//$.post('/cart/clear.js').always(function() {
waitForApi(function() {
return (typeof ga === 'function');
}, function() {
setTimeout(redirect, 1000);
ga(redirect);
}, function() {
redirect();
});
//});
});
});
function redirect() {
//window.top.location = '/pages/success?id=' + urlParam('id'); window.top.location = 'https://yoursite.com/pages/error?id=' + urlParam('id');
}
2. On your error page, send the GET request to:
https://shipearlyapp.com/shopify/getErrorDetails?id={id}
id is the value passed from page.shopifyError.liquid
3. You will receive a JSON response like the following:
{
"title": "Payment Error",
"message": "I’m sorry, our fraud protection detected some abnormalities with your transaction. To protect your credit card from fraud we did not process your order. If we have falsely denied your transaction, please verify your details or contact us at <a href=\"mailto:support@shipearly.com\">support@shipearly.com<\/a>",
"baseurl": "https:\/\/yourdomain.myshopify.com",
"basepath": "https:\/\/shipearlyapp.com\/shopify\/"
}
Comments
0 comments
Please sign in to leave a comment.