This issue is regarding Trust Badges, when implementing in Grid Template

I’m adding a custom section in the /section folder “trust-badges.liquid”. When I typed the code in HTML and CSS, everything was perfect and working fine. The issue started when I converted it into ‘.liquid’ file by adding {% for %} loop to render each block (i.e badge). Take a look at the code. I have also tagged the images as well. Feel free to ask anything you need to inspect further. Thanks in advance..!

When the code was first written in HTML & CSS:

Saradh_Chandra_0-1721714926830.png

When added to shopify

Saradh_Chandra_3-1721714926831.png


{% schema %}
{
    "name": "Trust Badges",
    "tag": "section",
    "class": "trust-badges",
    "presets": [
        {
            "name": "Custom Trust Badges"
        }
    ],
    "blocks": [
        {
            "type": "trust-badge",
            "name": "Trust Badge",
            "settings": [
                {
                    "type": "image_picker",
                    "id": "badge-image",
                    "label": "Badge Image"
                },
                {
                    "type": "text",
                    "id": "badge-title",
                    "label": "Badge Title",
                    "default": "Title"
                },
                {
                    "type": "textarea",
                    "id": "badge-context",
                    "label": "Badge Context"
                }
            ]
        }
    ],
    "settings": []
}
{% endschema %}

Hello @Saradh_Chandra , Kindly provide me with the URL of your store so that I can access it.

1 Like

Here’s the link: [ https://da094b-2d.myshopify.com/ ]
Use the password: [ fiages ]

Hello @Saradh_Chandra , Kindly locate the code provided below and make the necessary modifications as indicated. Additionally, refer to the screenshot for further guidance.

.saradh-trust-badges .trust-badges {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
}

Feel free to reach out if you have any additional questions. If this solution is helpful, please consider liking and accepting it.
S.P

1 Like

Even I did the same using flex but, I wanted to achieve this with the grid to have more control over the individual badge width and enable the scroll option without warping the badges.

@Huptech-Web have any solution for this issue?? Thanks for the above insights.

@Saradh_Chandra , The grid layout does not allow for this, so you should exclusively use the flex property in order to achieve the desired result. You can accomplish this task by simply making a few modifications to the code as demonstrated.

Attached is a screenshot to provide a clearer explanation.

.saradh-trust-badges {
    overflow-x: scroll;
    width: 100%;
}

If this solution is helpful, please consider liking and accepting it.
S.P

@Huptech-Web Thanks for the assist.

@Saradh_Chandra , I am pleased to assist you. Please do not hesitate to contact us if you have any further inquiries.