Guest Posted March 23, 2021 Posted March 23, 2021 Hi, I am trying to utilize a Jotform when hitting the add to cart, in the same way that the Squarespace product form pops up when you hit add to cart.
Guest Posted April 29, 2021 Posted April 29, 2021 I was able to get it working with an upsell code somone made. I changed the code where it says ***This is where you insert your custom url*** to redirect to a hidden page that I embedded on the product page>advanced>code injection. That way it will only show for the product you choose. Form code injected at footer of product page additional info <!-- 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 = "/***This is where you insert your custom url*** //////////////////////////////// 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 ended up going with the default product form from squarespace as there was no way to associate the jotform with an order and no way to manually add info to account. I set up a basic on the product page and advanced order form at the bottom of papers page in the shop. You can check out how I implemented the jotform here, www.jonathanfrancisfineprints.com
Recommended Posts
Archived
This topic is now archived and is closed to further replies.