Create a hidden products via SDK

Create a hidden products via SDK

gk-wa
Shopify Partner
3 0 0

I am creating a plugin for Shopify.

 

My requirement is the following:

1. When a user visits the product page I want to create and show an Add-on product that is created on the fly

2. I want that add-on product to be purchasable

3. The product should not be listed in the store nor be searchable

 

I have written logic for the products that are created dynamically and purchasable. But I need your input in making the product hidden on the store.

 

Your help is appreciated!

 

Thanks

Replies 3 (3)

Jason
Shopify Partner
11201 226 2311

There's a metafield that will help to remove it from your shopify search - assuming you use that are not leveraging a third party search app. Add that to the product and it will be much harder for someone to find it.

 

Take a look at this page:
https://shopify.dev/api/examples/marketing-seo#hide-a-resource-from-search-engines-and-sitemaps

 

You will also need to make sure it doesn't show in collections like the default "all" one. 

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
gk-wa
Shopify Partner
3 0 0

Thank you @Jason

 

I will enable the SEO meta data part.

 

But I don't understand 

You will also need to make sure it doesn't show in collections like the default "all" one. 

 

I tried creating an automated collection and added some products to it. But I still see the products on the home page.

 

Can you please elaborate or share some docs about it?

 

Thanks

Jason
Shopify Partner
11201 226 2311

Hard to elaborate without seeing the code of your theme. But in general, as the code loops over the products to show you would need to either:

  1. skip those products (eg: if product has that metafield don't show it)
  2. or make sure they are removed from the collection in the first place.

Now option 1 has drawbacks to in which you might expect to see 20 products on a page. if there's 3 products being skipped you'd only see 17. Layouts can look odd a times hence why trying to avoid them being in collections in the first place is ideal.


★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★