notrab / headless-dropshipping-starter

Create your own dropshipping store with Next.js, Snipcart & Printful 👕
https://headlessdropshipping.com
693 stars 132 forks source link

Filter product types #114

Open juanfernandes opened 10 months ago

juanfernandes commented 10 months ago

I'd like to create a filter or pages that show products under a specific category, for example Stickers / T-Shirts / Hoodies etc

Is this possible and does someone know how I could achieve this? Specifically react/js/api code

Thanks in advance and thanks Jamie for creating this great resource!

juanfernandes commented 10 months ago

Did I explain what I want to achieve properly? Has anyone done this? At the moment it's not much of an issue, but as soon as I get more products listed, it will be difficult to find items.

juanfernandes commented 9 months ago

Ok, so turns out that you can't categorize products in Printful if you're using an API store, as opposed to WooCommerce or similar. So does anyone know how I could achieve this?

notrab commented 9 months ago

Hey @juanfernandes

You'd likely need to have your own datastore, you could do this locally using an object map where the key is the category and then the value is an array of product IDs.

Obviously that scales to a certain point point but when it grows bigger and you need more flexibility, you might want to bring in something a bit more bespoke for that.

juanfernandes commented 9 months ago

Hey @notrab thanks for the response. I'm not knowledgeable enough to do something like that.

I am however working on a very simplistic way to filtering - but creating a data-product attribute and taking the last word of each product title. I just make sure all my product names end with Tshirt Sticker Hoodie etc

This first part is done, now I need to create the filtering part and see if it works

notrab commented 9 months ago

@juanfernandes if you have your code on GitHub I'd be more than happy to take a look to provide any help or suggestions. Have a great weekend.