moretrobin Posted April 15, 2020 Share Posted April 15, 2020 Site URL: https://kindstudio.fr/shop Hey, I'm trying to find a way to redirect users to a specific page (shop page with all products) when they click on add-to-cart from a product page. Example of product page : https://kindstudio.fr/shop/apron Redirection wanted : https://kindstudio.fr/shop Any help would be appreciate here 🙂 Robin Link to comment
Guest Posted April 16, 2020 Share Posted April 16, 2020 14 hours ago, moretrobin said: Site URL: https://kindstudio.fr/shop Hey, I'm trying to find a way to redirect users to a specific page (shop page with all products) when they click on add-to-cart from a product page. Example of product page : https://kindstudio.fr/shop/apron Redirection wanted : https://kindstudio.fr/shop Any help would be appreciate here 🙂 Robin Looking for the same thing! Help! Link to comment
moretrobin Posted April 26, 2020 Author Share Posted April 26, 2020 Have you found a solution yet ? Anyone can help us with this ? Thank you !! Link to comment
likemindedproductions Posted January 24, 2022 Share Posted January 24, 2022 Are you still in need for a solution to this? Link to comment
Guest41 Posted June 1, 2022 Share Posted June 1, 2022 On 1/24/2022 at 1:25 PM, likemindedproductions said: Are you still in need for a solution to this? I just found this post but do need a solution for this. Link to comment
creedon Posted June 1, 2022 Share Posted June 1, 2022 Please see the following. Let us know how it goes. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects. Link to comment
likemindedproductions Posted June 3, 2022 Share Posted June 3, 2022 (edited) On 6/1/2022 at 3:19 AM, Guest41 said: I just found this post but do need a solution for this. Add this to Settings > Advanced > Code Injection > Header: <!-- Redirect to Page after clicking on 'Add To Cart' Button --> <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:not(.ProductItem-details--mobile)"),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 page after clicking on Add To Cart Button --> Edited June 3, 2022 by likemindedproductions Correct HTML Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment