You can send your questions to my email to get faster answer in 24 hours (free).
Buy me a coffee

Click Pricing Table Button – Open Checkout Page

Suppose you have a Pricing Table like this.
You want: when users click on the “Pay Monthly” button >> It will add the product to the cart and open the checkout page

click-pricing-table-button-open-checkout-page-01-min

#1. First, you need to create a Pricing Table, here I used a free plugin to create it.

#2. Edit 3 Pricing table buttons > Enter this URL (you can use the same format, whether you use the widget I shared above or any other tool)

click-pricing-table-button-open-checkout-page-02-min

click-pricing-table-button-open-checkout-page-03-min

click-pricing-table-button-open-checkout-page-04-min

and make sure this option “Open Link in New Tab” is disabled.

click-pricing-table-button-open-checkout-page-05-min

#3. Enable Express Checkout

#4. Add 3 Product Blocks under the Pricing Table.
My intention is, when users click on each button, the code will click the “Add to Cart” button of the corresponding product.

click-pricing-table-button-open-checkout-page-06-min

#5. Use the Squarespace ID Finder Tool (Free) to find the ID of 3 Product Blocks.
In my example, we will have:

  • Product 01: #block-yui_3_17_2_1_1709352666141_2217
  • Product 02: #block-yui_3_17_2_1_1709352666141_2878
  • Product 03: #block-yui_3_17_2_1_1709352666141_4615

click-pricing-table-button-open-checkout-page-07-min

#6. Use this code to Page Header Code Injection

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).on('click', 'a[href="#product01"]', function(event) { 
    event.preventDefault(); 
    $('div#block-yui_3_17_2_1_1709352666141_2217 .sqs-add-to-cart-button').click(); 
});
  $(document).on('click', 'a[href="#product02"]', function(event) { 
    event.preventDefault(); 
    $('#block-yui_3_17_2_1_1709352666141_2878 .sqs-add-to-cart-button').click(); 
});
  $(document).on('click', 'a[href="#product03"]', function(event) { 
    event.preventDefault(); 
    $('#block-yui_3_17_2_1_1709352666141_4615 .sqs-add-to-cart-button').click(); 
});
</script>

click-pricing-table-button-open-checkout-page-08-min

#7. Explain code

click-pricing-table-button-open-checkout-page-09-min

Ask me a question, free

If your site is private or in trial, just setup password and share url. See how to: https://beaverhero.com/squarespace-how-to/
Please check your email carefully. Recently I got a lot of questions with wrong emails.

If you haven't heard from me within 24 hours please check your junk/spam folder