Configuration Updated June 29, 2025

How to Hide the Product Samples Widget on Specific Shopify Pages

2 min read
195 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

Configuration

Customizing Sample Templates

You can easily update the text and markup shown in your sample widgets directly from…

Read Article β†’ 1 min read
Getting Started

How to Load the App Faster

This doc will show you how to improve app loading speeds! 1. From your Shopify…

Read Article β†’ 1 min read
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