-
Dashboard & Reports
-
Getting Started with AIOD - All Automatic Discount
-
App Configuration
- How to install AIOD – All Automatic Discount Manually?
- Configuration Discount Code with Ajax Cart
- Display Discount on Each Line Item of the Cart Page.
- Steps for Customer Accounts Required on Checkout Settings.
- Discount Applied on Cart Page but not on Checkout
- How to Change the Position of the Volume Table?
-
How to Create Discount Offers?
-
App Settings
-
Plans & Pricing
-
Other
-
Callback
Steps for Customer Accounts Required on Checkout Settings.
When you set the Customer accounts required for checkout and if the user does not log in and hit the checkout then Shopify will redirect the user to the login page.
And after login, Shopify will redirect the user to the Checkout. It is auto-redirect by Shopify so in this case, the automatic discount is not applied at the checkout.
In this situation, We have to redirect them to the cart page when they log in and prevent the auto-redirect to the checkout.
Below is the code which you have to add to the “customers/login.liquid” template.
<script>
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = window.location.search.substring(1),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
}
}
return false;
};
var autoredirect = getUrlParameter('checkout_url');
if(autoredirect != ''){
if(document.querySelector('form[action="/account/login"]') != null){
document.querySelector('form[action="/account/login"]').insertAdjacentHTML('beforeend', '<input name="checkout_url" type="hidden" value="/cart" />');
}
if(document.querySelector('form[action="/account"]') != null){
document.querySelector('form[action="/account"]').insertAdjacentHTML('beforeend', '<input name="return_to" type="hidden" value="/cart" />');
}
}
</script>

