Adding social proof to your product pages can significantly increase trust and conversion rates. In this tutorial, we'll show you how to add a stylish Verified Testimonials block to your Shopify store using the Dawn theme . This block displays user avatars, names, and a verified icon—all customizable from the theme editor. ✅ Step 1: Open the main-product.liquid file Go to your Shopify Admin. Navigate to: Online Store → Themes → Edit code . Open the file: sections/main-product.liquid . Now add this code exactly as I’ve shown in the video — and yes, make sure to test it on a duplicate theme first! Full Code {%- when 'verified-testimonials' -%} <style> .verified-testimonials-container-{{block.id}} .verified-testimonials-user-icon-img-class { width: {{block.settings.verified_use...
Creating a comparison table in Shopify can greatly enhance your customers' shopping experience by allowing them to compare features, prices, and other attributes of different products or brands easily. In this blog post, we'll walk you through the process of setting up a customizable comparison table in Shopify using Liquid and CSS.
Step 1: Set Up Your Shopify Section
Create a New Section
- Navigate to your Shopify admin panel.
- Go to Online Store > Themes > Actions > Edit Code.
- Under the Sections folder, click Add a new section and name it comparison-table.
Add the Liquid and HTML Code
Copy and paste the following code into your new section file:
Full code
<style> /* Your CSS styles for .comparison-table */ .comparison-table { margin: 2rem 0; padding: {{ section.settings.padding_top_bottom }}px 0; font-family: Arial, sans-serif; background-color: {{ section.settings.background_color }}; /* Dynamic background color from schema */ } .comparison-table-block{ border: {{ section.settings.table_border_width }}px solid {{ section.settings.table_border_color }}; /* Adding red border */ border-radius: {{ section.settings.table_border_radius }}px; /* Adding border radius */ max-width: {{ section.settings.max_width }}%; margin: 0 auto; } .comparison-table td:first-child, .comparison-table th:first-child { width: 50%; /* Adjust the width of the first column */ text-align: left; } .comparison-table h2 { text-align: center; font-size: {{ section.settings.title_size }}px; /* Dynamic title size from schema */ color: {{ section.settings.title_color }}; /* Dynamic title color from schema */ font-weight: {{ section.settings.title_font_weight }}; /* Dynamic title font weight from schema */ margin-bottom: 4rem; } .comparison-table table { width: 100%; border-collapse: collapse; text-align: center; border-spacing: 0; overflow: hidden; border: {{ section.settings.table_border_width }}px solid {{ section.settings.table_border_color }}; border-radius: {{ section.settings.table_border_radius }}px; /* Adding border radius */ box-shadow: none; } .comparison-table th, .comparison-table td { padding: 6px !important; color: {{ section.settings.text_color }}; /* Dynamic text color from schema */ text-align: {{ section.settings.text_alignment }}; /* Dynamic text alignment from schema */ border: {{ section.settings.table_border_width }}px solid {{ section.settings.table_border_color }} !important; } .comparison-table th { font-size: {{ section.settings.text_alignment_size_hd }}px; } .comparison-table td { font-size: {{ section.settings.text_alignment_size }}px; } .comparison-table th { background-color: {{ section.settings.header_background_color }}; /* Dynamic header background color from schema */ font-weight: bold; } .comparison-table td { background-color: #fff; /* Default background color for table cells */ } .comparison-table tr:nth-child(even) td { background-color: {{ section.settings.alternate_row_background_color }}; /* Alternate row background color */ } .comparison-table strong { display: block; margin-bottom: 0.5rem; font-size: 1.1rem; } .comparison-table p { margin: 0; } .comparison-table .checkmark { color: {{ section.settings.tick_color }}; /* Dynamic tick color from schema */ font-size: {{ section.settings.tick_width }}px; /* Dynamic tick icon width from schema */ } .comparison-table .crossmark { color: {{ section.settings.cross_color }}; /* Dynamic cross color from schema */ font-size: {{ section.settings.tick_width }}px; /* Dynamic cross icon width from schema */ } .comparison-table .brand-logo { max-width: {{ section.settings.brand_image_width }}%; /* Adjust max-width as needed */ height: auto; /* Maintain aspect ratio */ } @media (max-width: 780px) { .comparison-table .brand-logo { max-width: 100%; } .comparison-table td { font-size: {{ section.settings.text_alignment_size_mob }}px; } .comparison-table h2 { font-size: {{ section.settings.title_size_mob }}px; } .comparison-table th { font-size: {{ section.settings.text_alignment_size_hd_mob }}px; } } </style> <div class="comparison-table"> <h2>{{ section.settings.title }}</h2> <div class="comparison-table-block"> <table> <thead> <tr> <th></th> <th> {% if section.settings.brand_image != blank %} <img src="{{ section.settings.brand_image | img_url: 'master' }}" alt="Melli Logo" class="brand-logo"> {% else %} {{ section.settings.brand_name }} {% endif %} </th> <th>{{ section.settings.other_brand_name }}</th> </tr> </thead> <tbody> {% for row in section.blocks %} <tr> <td> {{ row.settings.feature_description }} </td> <td> {% if row.settings.brand_text != blank %} <p>{{ row.settings.brand_text }}</p> {% else %} {% if row.settings.brand_check == '✔' %} {% if section.settings.check_image != blank %} <img src="{{ section.settings.check_image | img_url: 'small' }}" alt="Check"> {% else %} <span class="checkmark">✔</span> {% endif %} {% else %} {% if section.settings.cross_image != blank %} <img src="{{ section.settings.cross_image | img_url: 'small' }}" alt="Cross"> {% else %} <span class="crossmark">✖</span> {% endif %} {% endif %} {% endif %} </td> <td> {% if row.settings.other_brands_text != blank %} <p>{{ row.settings.other_brands_text }}</p> {% else %} {% if row.settings.other_brands_check == '✔' %} {% if section.settings.check_image != blank %} <img src="{{ section.settings.check_image | img_url: 'small' }}" alt="Check"> {% else %} <span class="checkmark">✔</span> {% endif %} {% else %} {% if section.settings.cross_image != blank %} <img src="{{ section.settings.cross_image | img_url: 'small' }}" alt="Cross"> {% else %} <span class="crossmark">✖</span> {% endif %} {% endif %} {% endif %} </td> </tr> {% endfor %} </tbody> </table> </div> </div> {% schema %} { "name": "Comparison Table", "settings": [ { "type": "text", "id": "title", "label": "Table Title", "default": "Comparison Table" }, { "type": "color", "id": "title_color", "label": "Title Color", "default": "#333" }, { "type": "range", "id": "title_size", "label": "Title Size", "min": 12, "max": 60, "step": 1, "unit": "px", "default": 30 }, { "type": "range", "id": "title_size_mob", "label": "Mobile Title Size", "min": 8, "max": 60, "step": 1, "unit": "px", "default": 20 }, { "type": "select", "id": "title_font_weight", "label": "Title Font Weight", "options": [ { "value": "normal", "label": "Normal" }, { "value": "bold", "label": "Bold" }, { "value": "bolder", "label": "Bolder" }, { "value": "lighter", "label": "Lighter" }, { "value": "100", "label": "100" }, { "value": "200", "label": "200" }, { "value": "300", "label": "300" }, { "value": "400", "label": "400" }, { "value": "500", "label": "500" }, { "value": "600", "label": "600" }, { "value": "700", "label": "700" }, { "value": "800", "label": "800" }, { "value": "900", "label": "900" } ], "default": "bold" }, { "type": "text", "id": "brand_name", "label": "Brand Name", "default": "Brand Name" }, { "type": "image_picker", "id": "brand_image", "label": "Brand Image" }, { "type": "range", "id": "brand_image_width", "label": "Brand image Size", "min": 10, "max": 100, "step": 1, "unit": "%", "default": 50 }, { "type": "text", "id": "other_brand_name", "label": "Other Brand Name", "default": "Other" }, { "type": "image_picker", "id": "check_image", "label": "Tick Image" }, { "type": "image_picker", "id": "cross_image", "label": "Cross Image" }, { "type": "color", "id": "tick_color", "label": "Tick Color", "default": "#008000" }, { "type": "color", "id": "cross_color", "label": "Cross Color", "default": "#808080" }, { "type": "color", "id": "background_color", "label": "Background Color", "default": "#fff" }, { "type": "color", "id": "header_background_color", "label": "Header Background Color", "default": "#f4f4f4" }, { "type": "color", "id": "text_color", "label": "Text Color", "default": "#333" }, { "type": "range", "id": "tick_width", "label": "Tick Icon Width", "min": 10, "max": 30, "step": 1, "unit": "px", "default": 20 }, { "type": "select", "id": "text_alignment", "label": "Text Alignment", "options": [ { "value": "left", "label": "Left" }, { "value": "center", "label": "Center" }, { "value": "right", "label": "Right" } ], "default": "left" }, { "type": "range", "id": "text_alignment_size_hd", "label": "Table heading", "min": 10, "max": 30, "step": 1, "unit": "px", "default": 20 }, { "type": "range", "id": "text_alignment_size_hd_mob", "label": "Table heading mobile", "min": 6, "max": 30, "step": 1, "unit": "px", "default": 15 }, { "type": "range", "id": "text_alignment_size", "label": "Table data content text size", "min": 10, "max": 30, "step": 1, "unit": "px", "default": 20 }, { "type": "range", "id": "text_alignment_size_mob", "label": "Table data content text size mob", "min": 10, "max": 30, "step": 1, "unit": "px", "default": 13 }, { "type": "range", "id": "max_width", "label": "Table width", "min": 50, "max": 100, "step": 1, "unit": "%", "default": 100 }, { "type": "range", "id": "table_border_width", "min": 1, "max": 24, "step": 1, "unit": "px", "label": "Table border width", "default": 1 }, { "type": "color", "id": "table_border_color", "label": "Table border color", "default": "#ff0000" }, { "type": "range", "id": "table_border_radius", "min": 1, "max": 24, "step": 1, "unit": "px", "label": "Table border radius", "default": 5 }, { "type": "range", "id": "padding_top_bottom", "label": "Padding Top and Bottom", "min": 0, "max": 100, "step": 1, "unit": "px", "default": 20 }, { "type": "color", "id": "alternate_row_background_color", "label": "Alternate Row Background Color", "default": "#f9f9f9" } ], "blocks": [ { "type": "row", "name": "Row", "settings": [ { "type": "textarea", "id": "feature_description", "label": "Description" }, { "type": "text", "id": "brand_text", "label": "Brand Text (Leave blank if using icon)", "default": "Brand text" }, { "type": "select", "id": "brand_check", "label": "Brand Check", "options": [ { "value": "✔", "label": "Check" }, { "value": "✘", "label": "Cross" } ], "default": "✔" }, { "type": "text", "id": "other_brands_text", "label": "Other Brands Text (Leave blank if using icon)", "default": "Other brands text" }, { "type": "select", "id": "other_brands_check", "label": "Other Brands Check", "options": [ { "value": "✔", "label": "Check" }, { "value": "✘", "label": "Cross" } ], "default": "✘" } ] } ], "presets": [ { "name": "Comparison Table" } ] } {% endschema %}
Can you tell please, how to add 4 columns instead of 2?
ReplyDelete