Jump to content

andreab

Circle Member
  • Posts

    540
  • Joined

  • Last visited

  • Days Won

    2

Community Answers

  1. andreab's post in Redirect add to cart button was marked as the answer   
    @trekyourmarket Here is a more elegant solution that will not interfere with putting items into the Cart:You can run a script that will, after they click "Add to Cart", reveal a gallery of Add-Ons related to that product, that they can then click on and purchase. You can see an example here:https://amazing-andrea-533j.squarespace.com/shop/(When you reach the site, just click the [Visitor Access] button and follow the instructions. Note that when you arrive in the shop there are 4 items. Only 2 items are "Add-Ons". Click on the "Digital Rescue" product. Then click "Add to Cart". The Gallery featuring the two Add-Ons is now revealed. )
    To create this:
    A) Put all of the "Add-Ons" for an item in the same Category. For example, if you have Monograms for Blankets and Custom Packaging for Blankets (I'm making stuff up here!) put them both in the Category "Addon-Blanket".B) In the "main product" under "Additional Info" add a Summary Block (I used Carousel) and point it to the Shop, and Filter by the "Category" designed for this product's Add-Ons.C) Below that Summary Block, add a Code Block that has this code:
    <script> $(function() { var $button = $('.sqs-add-to-cart-button'); $button.on('click', function(){ $('div.sqs-block.summary-v2-block.sqs-block-summary-v2').appendTo('.Share-buttons'); $('div.sqs-block.summary-v2-block.sqs-block-summary-v2').css("display", "block"); }); }); </script>
    In the Shop's Page Settings, under Advanced, add this code to the Page Header Code Injection:
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <style> .sqs-block.summary-v2-block.sqs-block-summary-v2 { display: none; } </style>
    IMPORTANT, Under Settings > Commerce > Checkout make sure that "Enable Express Checkout" is NOT ENABLED or this won't work.
    NOTE: The Classes .sqs-add-to-cart-button and .sqs-add-to-cart-button-inner are how the script targets the "Add to Cart" button. There's a chance that the template you're using uses different Classes, but without a link to your site, I was unable to confirm that.
    Good luck!
×
×
  • 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.