Hi!
I have found a useful code that I can add to my product info for redirecting to an upsell page when my clients add to cart from the product page. But I would need to make it work also when they just add the product to the cart from the single button I have embedded on the sales page. Could anyone help me with this?
My sales page for that product is:
https://anazaragoza-copywriter.com/sistema-revivir-web-muerta
And the code is this one:
<!-- Redirect to Upsell Page after clicking on Add To Cart Button -->
<!-- Author: Dmitry Kiselyov @_dmitrykiselyov -->
<script>
// /upsell-page is the default URL. To change it, replace /upsell-page with the required URL.
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 #productDetails, .collection-type-products.view-item .ProductItem-details"),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 -->
I suppose is just to modify sth here.
Thank you very much,
Ana