2

I want to redirect the shopper to the main shopping page after they've added an item to the cart. I am using Business Catalyst to build the cart, and I'm seeing a lot of outdated solutions to this problem but not many new.

Here is what the button looks like right now:

<input class="productSubmitInput" name="AddToCart_Submit" type="submit" value="Purchase Now" onclick="AddToCart(150613,5623468,'',4,'','',true);return false;" />

What do I do??

L84
  • 45,514
  • 58
  • 177
  • 257

2 Answers2

2

From BC's old knowledgebase

Refreshing the page after adding a product to a cart

Add this code in the Site-Wide Template that your shopping cart is using (or link to this JavaScript in an external .js file).

<script type="text/javascript">
function AddProductExtras(){
document.location.reload(true);
}
</script>

Tested just now,

function AddProductExtras() { $('input[name="AddToCart_Submit"]').on('click',document.location.replace('/products')); }

Neido
  • 181
  • 7
0

When you use the {tag_addtocart} and a person adds a product to the cart, it will show an alert saying: item(s) added to your cart. So if you want to direct a user to the shopping page after they add an item, you can use the following code (this solution uses jQuery):

$(function() {

    window.alert = function(text) {
        if (text.indexOf("item(s) added to your cart") > -1) {
            window.location.href = "http://example.com/url-of-shopping-page";
        }
    }; 

});

Note: Add the above script into the Large Product layout.

L84
  • 45,514
  • 58
  • 177
  • 257