Modify Revy Bundle checkout redirect (Custom checkout integration, etc)

By default our Revy Bundle App work with Shopify Checkout, it will redirect from cart page to Shopify Checkout with the discount applied if the cart contains a Bundle.

But we do have an API command if the merchants/developer desire to redirect the customer to another URL that is not the Shopify Checkout one, basically this command will replace our redirector and also will contain the Bundle Discount Code generated (if any).

Note that this command will STOP our app from redirecting to Shopify Checkout, you need to add the redirect commands for both cases(when there is a Bundle discount, and when there is not).

The command is this:

window.RevyBundle.api.checkoutRedirectReplacer = function(discount_code) {
      if(discount_code) {
        console.log("Bundle discount code generated, the code is: ", discount_code)
        // Here you have the Bundle discount code available and you should redirect
      } else {
        console.log("None Bundle matches and none discount code was generated")
        // Here you redirect to a URL with none Bundle discount code
      }
 }

The code above must be used inside a Revy Bundle callback to make sure the app is loaded before execute it, the callback used is the onReady, here's this same code inside the callback:

<script>
window.revyBundleDataLayer = window.revyBundleDataLayer || []; 
window.revyBundleDataLayer.push({onReady: function() {
  
  window.RevyBundle.api.checkoutRedirectReplacer = function(discount_code) {
      if(discount_code) {
        console.log("Bundle discount code generated, the code is: ", discount_code)
        // Here you have the Bundle discount code available and you should redirect
      } else {
        console.log("None Bundle matches and none discount code was generated")
        // Here you redirect to a URL with none Bundle discount code
      } 
  }  
}}); 
</script>

We do recommend that you use this code at the bottom of the file snippets/revy-bundle-script.liquid, this file is created by our app in the moment you install the app.

This command can be used for many purposes but is particularly useful to integrate our Revy Bundle app with Custom Checkout Apps, a small modification on the example code can integrate both apps quickly and efficiently, depending on the other app integration capabilities.

If you have any questions about this topic or need any other help please let us know at [email protected], we will be happy to help you ;).

Still need help? Contact Us Contact Us