title: how to make redirect to a specific url?
body: <p>I am running opecart 3 with the new journal theme 3. 
  The product page has a "quick buy" button that automatically adds product details to the cart and then redirects the customer to the checkout page.</p>
  
  <p>I cannot seem to change the url for the quick_buy button. I need it to do what it does as above, but to instead redirect the user to a custom url..</p>
  
  <p>How can I achieve this?</p>
  
  <p>Code as seen here:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// Array includes polyfill
  if (!Array.prototype.includes) {
      Object.defineProperty(Array.prototype, 'includes', {
          value: function (searchElement, fromIndex) {
  
              if (this == null) {
                  throw new TypeError('"this" is null or not defined');
              }
  
              // 1. Let O be ? ToObject(this value).
              var o = Object(this);
  
              // 2. Let len be ? ToLength(? Get(O, "length")).
              var len = o.length &gt;&gt;&gt; 0;
  
              // 3. If len is 0, return false.
              if (len === 0) {
                  return false;
              }
  
              // 4. Let n be ? ToInteger(fromIndex).
              //    (If fromIndex is undefined, this step produces the value 0.)
              var n = fromIndex | 0;
  
              // 5. If n ≥ 0, then
              //  a. Let k be n.
              // 6. Else n &lt; 0,
              //  a. Let k be len + n.
              //  b. If k &lt; 0, let k be 0.
              var k = Math.max(n &gt;= 0 ? n : len - Math.abs(n), 0);
  
              function sameValueZero(x, y) {
                  return x === y || (typeof x === 'number' &amp;&amp; typeof y === 'number' &amp;&amp; isNaN(x) &amp;&amp; isNaN(y));
              }
  
              // 7. Repeat, while k &lt; len
              while (k &lt; len) {
                  // a. Let elementK be the result of ? Get(O, ! ToString(k)).
                  // b. If SameValueZero(searchElement, elementK) is true, return true.
                  if (sameValueZero(o[k], searchElement)) {
                      return true;
                  }
                  // c. Increase k by 1.
                  k++;
              }
  
              // 8. Return false
              return false;
          }
      });
  }
  
  $(function () {
      // Currency
      $('#form-currency .currency-select').unbind().on('click', function (e) {
          e.preventDefault();
  
          $('#form-currency input[name=\'code\']').val($(this).data('name'));
  
          $('#form-currency').submit();
      });
  
      // Language
      $('#form-language .language-select').unbind().on('click', function (e) {
          e.preventDefault();
  
          $('#form-language input[name=\'code\']').val($(this).data('name'));
  
          $('#form-language').submit();
      });
  });
  
  window['cart'].add = function (product_id, quantity, quick_buy) {
      quantity = quantity || 1;
  
      $.ajax({
          url: 'index.php?route=checkout/cart/add',
          type: 'post',
          data: 'product_id=' + product_id + '&amp;quantity=' + quantity,
          dataType: 'json',
          beforeSend: function () {
              $('[data-toggle="tooltip"]').tooltip('hide');
              $('[onclick*="cart.add(\'' + product_id + '\'"]').button('loading');
          },
          complete: function () {
              $('[onclick*="cart.add(\'' + product_id + '\'"]').button('reset');
          },
          success: function (json) {
              $('.alert, .text-danger').remove();
  
              if (json['redirect']) {
                  if (json['options_popup']) {
                      if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) {
                          iNoBounce.enable();
                      }
  
                      var html = '';
  
                      html += '&lt;div class="popup-wrapper popup-options"&gt;';
                      html += '    &lt;div class="popup-container"&gt;';
                      html += '        &lt;button class="btn popup-close"&gt;&lt;/button&gt;';
                      html += '        &lt;div class="popup-body"&gt;';
                      html += '        &lt;div class="popup-inner-body"&gt;';
                      html += '            &lt;div class="journal-loading"&gt;&lt;i class="fa fa-spinner fa-spin"&gt;&lt;/i&gt;&lt;/div&gt;';
                      html += '            &lt;iframe src="index.php?route=journal3/product&amp;product_id=' + product_id + '&amp;popup=options&amp;product_quantity=' + quantity + '&amp;' + (quick_buy ? 'quick_buy=true' : '') + '" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.journal-loading\').fadeOut();"&gt;&lt;/iframe&gt;';
                      html += '        &lt;/div&gt;';
                      html += '        &lt;/div&gt;';
                      html += '    &lt;/div&gt;';
                      html += '    &lt;div class="popup-bg popup-bg-closable"&gt;&lt;/div&gt;';
                      html += '&lt;/div&gt;';
  
                      // show modal
                      $('.popup-wrapper').remove();
  
                      $('body').append(html);
  
                      setTimeout(function () {
                          $('html').addClass('popup-open popup-center');
                      }, 10);
                  } else {
                      location = json['redirect'];
                  }
              }
  
              if (json['success']) {
                  if (json['options_popup']) {
                      if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) {
                          iNoBounce.enable();
                      }
  
                      var html = '';
  
                      html += '&lt;div class="popup-wrapper popup-options"&gt;';
                      html += '    &lt;div class="popup-container"&gt;';
                      html += '        &lt;button class="btn popup-close"&gt;&lt;/button&gt;';
                      html += '        &lt;div class="popup-body"&gt;';
                      html += '        &lt;div class="popup-inner-body"&gt;';
                      html += '            &lt;div class="journal-loading"&gt;&lt;i class="fa fa-spinner fa-spin"&gt;&lt;/i&gt;&lt;/div&gt;';
                      html += '            &lt;iframe src="index.php?route=journal3/product&amp;product_id=' + product_id + '&amp;popup=options&amp;' + (quick_buy ? 'quick_buy=true' : '') + '" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.journal-loading\').fadeOut();"&gt;&lt;/iframe&gt;';
                      html += '        &lt;/div&gt;';
                      html += '        &lt;/div&gt;';
                      html += '    &lt;/div&gt;';
                      html += '    &lt;div class="popup-bg popup-bg-closable"&gt;&lt;/div&gt;';
                      html += '&lt;/div&gt;';
  
                      // show modal
                      $('.popup-wrapper').remove();
  
                      $('body').append(html);
  
                      setTimeout(function () {
                          $('html').addClass('popup-open popup-center');
                      }, 10);
                  } else {
                      if (json['notification']) {
                          show_notification(json['notification']);
  
                          if (quick_buy) {
                              location = 'index.php?route=checkout/checkout';
                          }
                      } else {
                          $('header').after('&lt;div class="alert alert-success"&gt;&lt;i class="fa fa-check-circle"&gt;&lt;/i&gt; ' + json['success'] + ' &lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;&lt;/div&gt;');
                      }
                  }
  
                  // Need to set timeout otherwise it wont update the total
                  setTimeout(function () {
                      $('#cart-total').html(json['total']);
                      $('#cart-items').html(json['items_count']);
                  }, 100);
  
                  if (Journal['scrollToTop']) {
                      $('html, body').animate({ scrollTop: 0 }, 'slow');
                  }
  
                  $('.cart-content ul').load('index.php?route=common/cart/info ul li');
  
                  if (parent.window['_QuickCheckout']) {
                      parent.window['_QuickCheckout'].save();
                  }
              }
          },
          error: function (xhr, ajaxOptions, thrownError) {
              alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText);
          }
      });
  };
  
  window['cart'].remove = function (key) {
      $.ajax({
          url: 'index.php?route=checkout/cart/remove',
          type: 'post',
          data: 'key=' + key,
          dataType: 'json',
          beforeSend: function () {
              $('#cart &gt; button').button('loading');
          },
          complete: function () {
              $('#cart &gt; button').button('reset');
          },
          success: function (json) {
              // Need to set timeout otherwise it wont update the total
              setTimeout(function () {
                  $('#cart-total').html(json['total']);
                  $('#cart-items').html(json['items_count']);
              }, 100);
  
              if ($('html').hasClass('route-checkout-cart') || $('html').hasClass('route-checkout-checkout')) {
                  location = 'index.php?route=checkout/cart';
              } else {
                  $('.cart-content ul').load('index.php?route=common/cart/info ul li');
              }
          },
          error: function (xhr, ajaxOptions, thrownError) {
              alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText);
          }
      });
  };
  
  window['cart'].update = function (key, quantity) {
      $.ajax({
          url: 'index.php?route=checkout/cart/edit',
          type: 'post',
          data: 'key=' + key + '&amp;quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),
          dataType: 'json',
          beforeSend: function () {
              $('#cart &gt; button').button('loading');
          },
          complete: function () {
              $('#cart &gt; button').button('reset');
          },
          success: function (json) {
              // Need to set timeout otherwise it wont update the total
              setTimeout(function () {
                  $('#cart-total').html(json['total']);
                  $('#cart-items').html(json['items_count']);
              }, 100);
  
              if ($('html').hasClass('route-checkout-cart') || $('html').hasClass('route-checkout-checkout')) {
                  location = 'index.php?route=checkout/cart';
              } else {
                  $('.cart-content ul').load('index.php?route=common/cart/info ul li');
              }
          },
          error: function (xhr, ajaxOptions, thrownError) {
              alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText);
          }
      });
  };
  
  window['wishlist'].add = function (product_id) {
      $.ajax({
          url: 'index.php?route=account/wishlist/add',
          type: 'post',
          data: 'product_id=' + product_id,
          dataType: 'json',
          success: function (json) {
              $('.alert').remove();
  
              if (json['redirect']) {
                  location = json['redirect'];
              }
  
              if (json['success']) {
                  $('[data-toggle="tooltip"]').tooltip('hide');
  
                  if (json['notification']) {
                      show_notification(json['notification']);
                  } else {
                      $('header').after('&lt;div class="alert alert-success"&gt;&lt;i class="fa fa-check-circle"&gt;&lt;/i&gt; ' + json['success'] + ' &lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;&lt;/div&gt;');
                  }
              }
  
              $('#wishlist-total span').html(json['total']);
              $('#wishlist-total').attr('title', json['total']);
              $('.wishlist-badge').text(json['count']);
  
              if (Journal['scrollToTop']) {
                  $('html, body').animate({ scrollTop: 0 }, 'slow');
              }
          },
          error: function (xhr, ajaxOptions, thrownError) {
              alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText);
          }
      });
  };
  
  window['compare'].add = function (product_id) {
      $.ajax({
          url: 'index.php?route=product/compare/add',
          type: 'post',
          data: 'product_id=' + product_id,
          dataType: 'json',
          success: function (json) {
              $('.alert').remove();
  
              if (json['success']) {
                  $('[data-toggle="tooltip"]').tooltip('hide');
  
                  if (json['notification']) {
                      show_notification(json['notification']);
                  } else {
                      $('header').after('&lt;div class="alert alert-success"&gt;&lt;i class="fa fa-check-circle"&gt;&lt;/i&gt; ' + json['success'] + ' &lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;&lt;/div&gt;');
                  }
  
                  $('#compare-total').html(json['total']);
                  $('.compare-badge').text(json['count']);
  
                  if (Journal['scrollToTop']) {
                      $('html, body').animate({ scrollTop: 0 }, 'slow');
                  }
              }
          },
          error: function (xhr, ajaxOptions, thrownError) {
              alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText);
          }
      });
  };
  
  window['quickview'] = function (product_id) {
      product_id = parseInt(product_id, 10);
  
      // hide tooltip
      $('[data-toggle="tooltip"]').tooltip('hide');
  
      var html = '';
  
      html += '&lt;div class="popup-wrapper popup-quickview"&gt;';
      html += '    &lt;div class="popup-container"&gt;';
      html += '        &lt;button class="btn popup-close"&gt;&lt;/button&gt;';
      html += '        &lt;div class="popup-body"&gt;';
      html += '            &lt;div class="popup-inner-body"&gt;';
      html += '                &lt;div class="journal-loading"&gt;&lt;i class="fa fa-spinner fa-spin"&gt;&lt;/i&gt;&lt;/div&gt;';
      html += '                &lt;iframe src="index.php?route=journal3/product&amp;product_id=' + product_id + '&amp;popup=quickview" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.journal-loading\').hide();"&gt;&lt;/iframe&gt;';
      html += '            &lt;/div&gt;';
      html += '        &lt;/div&gt;';
      html += '    &lt;/div&gt;';
      html += '    &lt;div class="popup-bg popup-bg-closable"&gt;&lt;/div&gt;';
      html += '&lt;/div&gt;';
  
      // show modal
      $('.popup-wrapper').remove();
  
      $('body').append(html);
  
      setTimeout(function () {
          $('html').addClass('popup-open popup-center');
      }, 10);
  };
  
  window['open_popup'] = function (module_id) {
      if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) {
          iNoBounce.enable();
      }
  
      module_id = parseInt(module_id, 10);
  
      var html = '';
  
      html += '&lt;div class="popup-wrapper popup-module"&gt;';
      html += '    &lt;div class="popup-container"&gt;';
      html += '        &lt;button class="btn popup-close"&gt;&lt;/button&gt;';
      html += '        &lt;div class="popup-body"&gt;';
      html += '        &lt;div class="popup-inner-body"&gt;';
      html += '        &lt;/div&gt;';
      html += '        &lt;/div&gt;';
      html += '    &lt;/div&gt;';
      html += '    &lt;div class="popup-bg popup-bg-closable"&gt;&lt;/div&gt;';
      html += '&lt;/div&gt;';
  
      // show modal
      $('.popup-wrapper').remove();
  
      $('body').append(html);
  
      setTimeout(function () {
          $('html').addClass('popup-open popup-center');
      }, 10);
  
      $('.popup-container').css('visibility', 'hidden');
  
      $.ajax({
          url: 'index.php?route=journal3/popup/get&amp;module_id=' + module_id + '&amp;popup=module',
          success: function (html) {
              var $html = $(html);
              var $popup = $html.siblings('.module-popup');
              var $style = $html.siblings('style');
              var $content = $popup.find('.popup-container');
  
              $('#popup-style-' + module_id).remove();
              $('head').append($style.attr('id', 'popup-style-' + module_id));
              $('.popup-wrapper').attr('class', $popup.attr('class'));
              $('.popup-container').html($content.html());
  
              $('.popup-container').css('visibility', 'visible');
          },
          error: function (xhr, ajaxOptions, thrownError) {
              alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText);
          }
      });
  };
  
  window['open_login_popup'] = function () {
      if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) {
          iNoBounce.enable();
      }
  
      var html = '';
  
      html += '&lt;div class="popup-wrapper popup-login"&gt;';
      html += '    &lt;div class="popup-container"&gt;';
      html += '        &lt;button class="btn popup-close"&gt;&lt;/button&gt;';
      html += '        &lt;div class="popup-body"&gt;';
      html += '        &lt;div class="popup-inner-body"&gt;';
      html += '            &lt;div class="journal-loading"&gt;&lt;i class="fa fa-spinner fa-spin"&gt;&lt;/i&gt;&lt;/div&gt;';
      html += '            &lt;iframe src="index.php?route=account/login&amp;popup=login" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.journal-loading\').fadeOut();"&gt;&lt;/iframe&gt;';
      html += '        &lt;/div&gt;';
      html += '        &lt;/div&gt;';
      html += '    &lt;/div&gt;';
      html += '    &lt;div class="popup-bg popup-bg-closable"&gt;&lt;/div&gt;';
      html += '&lt;/div&gt;';
  
      // show modal
      $('.popup-wrapper').remove();
  
      $('body').append(html);
  
      setTimeout(function () {
          $('html').addClass('popup-open popup-center');
      }, 10);
  };
  
  window['open_register_popup'] = function () {
      if ($('html').hasClass('iphone') || $('html').hasClass('ipad')) {
          iNoBounce.enable();
      }
  
      var html = '';
  
      html += '&lt;div class="popup-wrapper popup-register"&gt;';
      html += '    &lt;div class="popup-container"&gt;';
      html += '        &lt;button class="btn popup-close"&gt;&lt;/button&gt;';
      html += '        &lt;div class="popup-body"&gt;';
      html += '        &lt;div class="popup-inner-body"&gt;';
      html += '            &lt;div class="journal-loading"&gt;&lt;i class="fa fa-spinner fa-spin"&gt;&lt;/i&gt;&lt;/div&gt;';
      html += '            &lt;iframe src="index.php?route=account/register&amp;popup=register" width="100%" height="100%" frameborder="0" onload="this.height = this.contentWindow.document.body.offsetHeight; $(this).prev(\'.journal-loading\').fadeOut();"&gt;&lt;/iframe&gt;';
      html += '        &lt;/div&gt;';
      html += '        &lt;/div&gt;';
      html += '    &lt;/div&gt;';
      html += '    &lt;div class="popup-bg popup-bg-closable"&gt;&lt;/div&gt;';
      html += '&lt;/div&gt;';
  
      // show modal
      $('.popup-wrapper').remove();
  
      $('body').append(html);
  
      setTimeout(function () {
          $('html').addClass('popup-open popup-center');
      }, 10);
  };
  
  window['show_notification'] = function (opts) {
      opts = $.extend({
          position: 'center',
          className: '',
          title: '',
          image: '',
          message: '',
          buttons: [],
          timeout: Journal.notificationHideAfter
      }, opts);
  
      if ($('.notification-wrapper-' + opts.position).length === 0) {
          $('body').append('&lt;div class="notification-wrapper notification-wrapper-' + opts.position + '"&gt;&lt;/div&gt;');
      }
  
      var html = '';
  
      var buttons = $.map(opts.buttons, function (button) {
          return '&lt;a class="' + button.className + '" href="' + button.href + '"&gt;' + button.name + '&lt;/a&gt;';
      });
  
      html += '&lt;div class="notification ' + opts.className + '"&gt;';
      html += '    &lt;button class="btn notification-close"&gt;&lt;/button&gt;';
      html += '    &lt;div class="notification-content"&gt;';
  
      if (opts.image) {
          html += '        &lt;img src="' + opts.image + '" srcset="' + opts.image + ' 1x, ' + opts.image2x + ' 2x"&gt;';
      }
  
      html += '        &lt;div&gt;';
      html += '            &lt;div class="notification-title"&gt;' + opts.title + '&lt;/div&gt;';
      html += '            &lt;div class="notification-text"&gt;' + opts.message + '&lt;/div&gt;';
      html += '        &lt;/div&gt;';
      html += '    &lt;/div&gt;';
  
      if (buttons &amp;&amp; buttons.length) {
          html += '&lt;div class="notification-buttons"&gt;' + buttons.join('\n') + '&lt;/div&gt;';
      }
  
      html += '&lt;/div&gt;';
  
      var $notification = $(html);
  
      $('.notification-wrapper-' + opts.position).append($notification);
  
      if (opts.timeout) {
          setTimeout(function () {
              $notification.find('.notification-close').trigger('click');
          }, opts.timeout);
      }
  
      return $notification;
  };
  
  window['loader'] = function (el, status) {
      var $el = $(el);
  
      if (status) {
          $el.attr('style', 'position: relative');
          $el.append('&lt;div class="journal-loading-overlay"&gt;&lt;div class="journal-loading"&gt;&lt;i class="fa fa-spinner fa-spin"&gt;&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;');
      } else {
          $el.attr('style', '');
          $el.find('.journal-loading-overlay').remove();
      }
  };
  
  window['resize_iframe'] = function (module_id, height) {
      $('.module-popup-' + module_id + ' iframe').height(height);
  };</code></pre>
  </div>
  </div>
  </p>