Jump to content

Using an upsell plug in – bypassing my form

Recommended Posts

Hi there,

I have implemented an upsell plug in – code below. Unfortunately it means that it bypasses the form that pops up when the user clicks 'add to cart'.

Anyway to stop it bypassing the form? (As the form is crucial in this case!)

Thanks in advance,




<!-- Redirect to Upsell Page after clicking on Add To Cart Button -->
<!-- Author: Dmitry Kiselyov @_dmitrykiselyov -->
// /upsell-page is the default URL. You can change it.
var upsellPageUrl = "/upsell-page"
function redirectToUpsellPageHandler(wrapper){var addToCartButton=wrapper.querySelector(".sqs-add-to-cart-button"),productVariants=wrapper.querySelector(".product-variants");function isVariantInStock(){return productVariants.getAttribute("data-variant-in-stock")}function onClick(){(productVariants&&isVariantInStock()||!productVariants)&&setTimeout((function(){document.location.href=upsellPageUrl}),1200)}addToCartButton&&addToCartButton.addEventListener("click",onClick)}function redirectToUpsellPage(){var productPage=document.querySelector(".collection-type-products.view-item"),productBlocks;productPage&&redirectToUpsellPageHandler(productPage),[].slice.call(document.querySelectorAll(".sqs-block-product")).forEach(redirectToUpsellPageHandler)}document.addEventListener("DOMContentLoaded",redirectToUpsellPage),window.addEventListener("mercury:load",redirectToUpsellPage);</script>
<!-- end Redirect to Upsell Page after clicking on Add To Cart Button -->

Link to comment
  • Replies 7
  • Views 324
  • Created
  • Last Reply
  • 1 month later...
1 hour ago, Olivia_Scholes said:

@Jess-7992 Have you found a solution for this? I also need to create a redirect but the form for my products are necessary to my store. 

Dmitry updated new code in instructions.html. If you purchased Lightbox plugin, you will see.

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 4 weeks later...


This topic is now archived and is closed to further replies.

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.