How can I create a global rule to hide low stock items from search results?

How can I create a global rule to hide low stock items from search results?

Calum375
Shopify Partner
42 0 3

Hi,

 

We have a Collection Rule that removes items from the website when the quantity <= 1.  This works well, however the rule removes the item from the collection but it is still visible via the Search.  Are we able to create a global rule, not based on collections, that will remove the item completely so the item is not visible from the search?  Items with quantity of 1 are then sold only through the physical shop.

Replies 2 (2)

TypicalTomo
Shopify Partner
9 1 0

Hi there!

 

You will need a developer to filter out your search results if you want this to go automatically. Alternatively, you can create a hidden SEO metafield. By activating the field, the product will be hidden from recommendations and search results.

 

To do it:

  1. In your Shopify dashboard, go to store settings.
  2. Open the 'Metafields' settings by clicking on the 'Metafields' button in the left sidebar.
  3. Click on 'Products' to opet products metafields:
    TypicalTomo_0-1672072679472.png

     

  4. Click on the green 'Add definition' button in the top right corner to create a new metafield.
  5. Set your metafield like this (the namespace and key field must be 'seo.hidden', the type should be 'Integer', one value, and it should be either 0 or 1):
    TypicalTomo_1-1672072864250.png

     

  6. Click on green 'Save' button in the top right corner.

To hide the product from the search or recommendation:

  1. In your Shopify dashboard, go to 'Products' and find a product you wish to hide.
  2. Open the product you wish to hide. On the bottom, you will find 'Metafields' section. Here, you should find the 'SEO hidden' metafield. Set the value of the field to '1' and click on 'Save'.

Your product will now not appear in the search results and recommendations. If there are more products that need to be hidden, you can use bulk editing to select more of them. Furthermore, you can also create a hidden inverted collection (that contains all the products that have the quantity <= 1) and filter the products by that section, and then set all of their 'SEO Hidden' fields to '0'.

 

 

Best regards,
Tomo
Calum375
Shopify Partner
42 0 3

Hi Tomo,

 

Thanks for that.

 

I've added the metafield definition.

 

Could you explain again how to add the hidden inverted collection for products of 1 or less? Is this a case of bulk selecting all products and then adding the same rule?

 

Thanks