Buy me a coffee

Summary Block: Add to Cart

This works with Summary Block Grid/List design only.
#1. Suppose we have a Summary Block with these Products. We will find the way to add “Add to Cart” button here.

Summary Block Add To Cart 1 Min

#2. First, edit each product > Additional Info > Add text “Add to Cart

Summary Block Add To Cart 2 Min

Highlight it > Enter this URL: #product100 (each product, you will enter a different number, you can use any numbers what you want, but read carefully below steps to make sure number here and number in next steps are consistent).
Make sure “Open in New Tab” is disabled.

Summary Block Add To Cart 3 Min

Summary Block Add To Cart4 Min

We will have this

Summary Block Add To Cart 5 Min

#3.1. Next, add a Section under Summary Block > Then add 3 Product Blocks

Summary Block Add To Cart 6 Min

Summary Block Add To Cart 7 Min

Make sure you enabled “Add to Cart button”

Summary Block Add To Cart 8 Min

We will have

Summary Block Add To Cart 9 Min

#3.2. Next, find ID of this Section
In my example, we will have:

section[data-section-id="671ec9546d81bb36bbe7db2d"]

Summary Block Add To Cart 10 Min

Next, use this code to Custom CSS box. Code will hide this Section from Preview/Live Mode, and show it in Edit Mode only.

body:not(.sqs-edit-mode-active) section[data-section-id="671ec9546d81bb36bbe7db2d"] {
  display:none;
}

Summary Block Add To Cart 11 Min

#4. Find ID of 3 Product Blocks.
In my example, we will have:

  • 100. One-hundred: #block-yui_3_17_2_1_1730070417388_21392
  • 99. Ninety-nine: #block-yui_3_17_2_1_1730070417388_22146
  • 98. Ninety-eight: #block-01208d116f9191496bd8

Summary Block Add To Cart 12 Min

#5. Use this code to Code Injection Footer (or Page Header Injection, Page where you use Summary Block).

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
  const products = {
    "product100": "block-yui_3_17_2_1_1730070417388_21392",
    "product99": "block-yui_3_17_2_1_1730070417388_22146",
    "product98": "block-01208d116f9191496bd8"
  };

  $.each(products, function(productID, blockID) {
    $(`a[href="#${productID}"]`).on("click", function(event){
      event.preventDefault();
      $(`#${blockID} .sqs-add-to-cart-button`)[0].click();
    });
  });
});
</script>

Summary Block Add To Cart 13 Min

When users click Add to Cart in Summary Block >> It will click Add to Cart in hidden Section Product Block.

Summary Block Add To Cart 14 Min

You need to change these values in the code

Summary Block Add To Cart 15 Min

#6. To style “Add to Cart” link, you can use this code to Custom CSS box

div.summary-item [href*="#product"] {
    background-color: #000;
    color: #fff;
    padding: 5px 10px;
    border-radius: 50px;
    transition: all 0.3s ease;
}
div.summary-item [href*="#product"]:hover {
    opacity: 0.7;
    transition: all 0.3s;
}

Summary Block Add To Cart 16 Min

Result

Summary Block Add To Cart 17 Min

#7. If you want to remove Excerpt under Price, you can use this CSS code

div.summary-item:has([href*="#product"]) p {
    display: none;
}
div.summary-item:has([href*="#product"]) p:has([href*="#product"]) {
    display: inline-block;
}

Summary Block Add To Cart 18 Min

Result

Summary Block Add To Cart 19 Min