Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If a button or link is not tied to a specific product or variant (such as a shopping cart page or a catalog page with multiple product selections) then you will need it is required to write script to read the product selection(s) before redirecting to the Checkout Champ checkout page.

Code Block
<script>
function fetchProducts() {
    var redirectRoute = "https://checkout.mystoresite.com?products="
    var products = "";
    //write code specific to your page to find all selected products
    //add products to redirectRoute in the following format
    //productId.variant:quantity
    //productId = CheckoutChamp campaign product ID (required)
    //variant = CheckoutChamp variant ID (optional, skip the period if no variant)
    //quantity = the quantity ordered (required)
    //separate multiple products with a semi-colon
    //example:
    //products = "125.42:1;126:2";
    
    window.onbeforeunload = null;
    if (window.location !== window.parent.location) {
        //  Inside IFrame
        window.parent.location.href = redirectRoute + products;
    } else {
        window.location.href = redirectRoute + products;
    }
}
</script>
<a href onclick="fetchProducts()">Buy Now</a>

Please view this guide for more details on building the redirect urls.

...