- Daily Developer Hurdles
- Posts
- SEO Hidden - Shopify's undocumented secret.
SEO Hidden - Shopify's undocumented secret.
If you have some products that you do not want your customers to see, here is the solution for you.
Context:
The merchant is having a Shopify store and selling products online. The merchant is using shopify’s default search feature.
Problem:
The store is selling some products that are part of free gift. These products are not part of any collection, and there is no direct link to these products anywhere in the store. But the customers are still able to find such products from the search result page.
Solution:
Use the seo.hidden
metafield to and set its value to 1. This will hide the product from the search result.
Prerequisites:
You know how to create new metafield definition in Shopify store.
Limitations:
This will not help if the customer already the direct url of the product.
If the merchant is using some third party app for the search feature, then this might or might not work.
Implementation:
Create a new Product level metafield:
Go to: Settings → Custom Data → Products → Add Definition
namespace:seo
key:hidden
datatype:Integer
Validations: Minimum value:0
Maximum value:1
Create new product metafield
Go to the product page and find this metafiled at the end of the page. And set it to
1
1
: product will be hidden from the search result0
: product will be visibleempty
: product will be visibleSet the metafield value
Bonus Tip:
If your store is having a lot of such products then having all of them in one draft collection will help a lot to refer them later.
To do this you can enable the Automated collections
toggle for this metafield and then create one collection with the rule to include products with seo.hidden
= 1
How to create Automatic Collection?, ok, this will be another article 👍
Thanks for joining me this far, I will be back next week with another article.
Till then, bye