Configuration Updated June 29, 2025

How to Hide the Product Samples Widget on Specific Shopify Pages

2 min read
17 views
Helpful (0)

Note:
You’ll need some familiarity with CSS and Shopify Liquid for these instructions. If you’re not comfortable editing code, please share this guide with your developer, or reach out to us for help.

Steps

  • 1. Go to your Shopify Admin:

    • Navigate to Online Store > Themes.

  • 2. Choose Your Theme:

    • Find the theme you want to edit and click Customize or Actions > Edit code.

  • 3. Open Your Layout File:

    • Usually, this file is named theme.liquid.

  • 4. Add the CSS Snippet:

    • Insert the following code just before the closing </body> tag.

Examples

1. Hide the widget on the homepage:

{%- if template contains 'index' -%}
  <style>
    [data-samples-widget] {
      display: none;
    }
  </style>
{%- endif -%}

2. Hide the widget on all standard pages:

{%- if template contains 'page' -%}
  <style>
    [data-samples-widget] {
      display: none;
    }
  </style>
{%- endif -%}

3. Hide the widget on a specific page by handle:

{%- if template contains 'page' and page.handle == 'handle-of-page-you-want-to-hide-widget' -%}
  <style>
    [data-samples-widget] {
      display: none;
    }
  </style>
{%- endif -%}

Replace handle-of-page-you-want-to-hide-widget with your actual page handle.

4. Hide the widget on other page types (collections, products, blogs, articles):

  • For collections:

    • Change the condition to {% if template contains 'collection' %}

  • For products:

    • Use {% if template contains 'product' %}

  • For blogs or articles:

    • Adjust accordingly, e.g. {% if template contains 'blog' %}

You can combine these conditions and add specific logic as needed for your store structure.

If you need more advanced control, want to target multiple page types, or have any questions, feel free to contact our support team!

Was this article helpful?

Help us improve our documentation

Still need help?

Can't find what you're looking for? Our support team is here to help.

Contact Support

Related Help Articles

Integration

Integrating With Product Samples App: Event Hooks & Advanced Settings

The Product Samples App fires custom JavaScript events at key stages, making it easy to…

Read Article → 3 min read
Integration

Using App Theme Blocks

With Shopify’s app block extensions, you can easily add and position the Get a Sample…

Read Article → 2 min read
Integration

How to Translate Product Samples App Text for Multi-Language Shopify Stores

The Product Samples App is built with global shoppers in mind!If your Shopify store serves…

Read Article → 5 min read