How To Remove Showing 1 Of 30 On Woocommerce Page

How to Remove “Showing 1-of-30 Results” from Your WooCommerce Shop Page (and Why You Might Want To)

Introduction:

One of the first things you’ll notice on a WooCommerce shop page is the display of results like “Showing 1-12 of 30 results.” While this information can be helpful for some users, it can also clutter your design and potentially detract from the overall shopping experience. For example, if you have a minimalistic design, the text could look out of place. Or, if you use custom pagination that’s very visually clear, this text becomes redundant. This article will guide you through how to remove this specific string from your WooCommerce store. We’ll cover several methods, from using a simple code snippet to more advanced customizations using your theme’s `functions.php` file, and also touch on the reasons why removing it might be the right choice for your online store.

Why Remove the “Showing Results” Text?

Before diving into the “how,” let’s consider the “why.” There are several compelling reasons to remove or modify the “Showing X-Y of Z results” text:

    • Improved Aesthetics: As mentioned before, in a clean, modern design, this text can appear unnecessary and disruptive. Removing it contributes to a more streamlined and visually appealing layout.
    • Redundancy: If you’re using a custom pagination design that clearly indicates the number of pages and the current selection, the standard WooCommerce text becomes redundant.
    • Mobile Optimization: On smaller screens, space is at a premium. Removing unnecessary text elements can significantly improve the user experience on mobile devices.
    • Branding Consistency: The default WooCommerce text may not align with your brand’s voice and style. Removing it allows you to either create a more subtle effect or add custom styling directly to your pagination.
    • User Experience: Some users might find the information distracting, particularly Explore this article on How To Change Woocommerce Cart Icon if the pagination is already intuitive.

    Methods for Removing the “Showing Results” Text

    Here’s a breakdown of the different methods you can use to remove the “Showing Results” text from your WooCommerce shop page. We’ll start with the simplest and move towards more advanced techniques. Always back up your website before making any code changes!

    Method 1: Using a Code Snippet (Recommended for Beginners)

    This is the easiest and most beginner-friendly method. You can use a plugin like “Code Snippets” (available in the WordPress plugin repository) to add the following code:

     add_filter( 'woocommerce_result_count', '__return_empty_string' ); 

    Explanation:

    • `add_filter()` is a WordPress function that allows you to modify the output of another function.
    • `’woocommerce_result_count’` is the filter hook specific to the “Showing Results” text.
    • `’__return_empty_string’` is a built-in WordPress function that returns an empty string, effectively removing the text.

    Steps:

    1. Install and activate the “Code Snippets” plugin.

    2. Go to “Snippets” -> “Add New.”

    3. Paste the code snippet into the editor.

    4. Give the snippet a title (e.g., “Remove WooCommerce Result Count”).

    5. Set the snippet to “Run Everywhere.”

    6. Save and activate the snippet.

    This method is simple, safe, and doesn’t require you to directly edit your theme files.

    Method 2: Adding Code to Your Theme’s `functions.php` File (Advanced)

    This method involves adding the same code snippet directly to your theme’s `functions.php` file. Use this method with caution and only if you’re comfortable editing code.

     function custom_remove_woocommerce_result_count() { return ''; } add_filter('woocommerce_get_catalog_ordering_args', 'custom_remove_woocommerce_result_count', 20); 

    Steps:

    1. Access your WordPress installation’s files via FTP or your hosting control panel’s file manager.

    2. Navigate to your theme’s folder (`wp-content/themes/your-theme-name`).

    3. Edit the `functions.php` file (make a backup first!).

    4. Add the code snippet to the end of the file.

    5. Save the changes.

    6. Clear your website’s cache.

    Important Considerations When Using `functions.php`:

    • Child Themes: Always use a child theme when making modifications to your theme’s files. This prevents your changes from being overwritten when the parent theme is updated.
    • Syntax Errors: Be extremely careful when editing code. A single syntax error (e.g., a missing semicolon) can break your website.

    Method 3: Overriding the Template File (Most Advanced – Not Recommended for Simple Removal)

    This is the most advanced method and generally not recommended just for removing the text. It involves overriding the WooCommerce template file responsible for displaying the result count. This is useful if you want to completely Discover insights on How To Setup Woocommerce Checkout Page customize the output, not just remove it. You’ll need to understand WooCommerce’s template structure.

    1. Locate the Template File: The relevant template file is usually located at `woocommerce/templates/loop/result-count.php`. You might Check out this post: How To Manage Orders In Woocommerce find it in `wp-content/plugins/woocommerce/templates/loop/result-count.php`.

    2. Create the Correct Directory Structure in Your Theme: In your child theme’s directory, create the following directory structure: `woocommerce/loop/`.

    3. Copy the Template File: Copy the `result-count.php` file from the WooCommerce plugin’s template directory to the `woocommerce/loop/` directory in your child theme.

    4. Edit the Copied File: Open the copied `result-count.php` file in your child theme and remove or modify the code that outputs the “Showing Results” text. You’ll likely be removing or commenting out the entire block.

    5. Save the Changes.

    Why This Method Is Generally Not Recommended for Simple Removal:

    • Complexity: It’s more complex than the other methods.
    • Maintenance: If WooCommerce updates its template files, you’ll need to update your overridden template file to ensure compatibility.
    • Overkill: For simply removing the text, the other methods are much simpler and more efficient.

Conclusion:

Removing the “Showing X-Y of Z results” text from your WooCommerce shop page is a simple yet effective way to improve your store’s aesthetics and user experience. The easiest and recommended method for beginners is to use a code snippet plugin. More advanced users can edit their theme’s `functions.php` file, but remember the importance of using a child theme. Overriding the template file is generally not necessary for simply removing the text and should only be considered if you require extensive customization of the output. By following these steps, you can easily tailor your WooCommerce store to better suit your brand and provide a more seamless shopping experience for your customers. Remember to always back up your website before making any changes!

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *