How to find all the collections that your product belongs to on Shopify

Shopify’s REST API is a powerful tool for managing your store. It gives your apps direct access to product catalogues, customer records, and orders for just about any analysis you can imagine. However, the path to the data you need is not always obvious. For instance, it’s easy to find a product inside of a collection, but what if you need a list of collections that your product belongs to?

This is really useful data if you have a lot of product collections, whether they are created by hand or generated automatically. The answer to this question is not found in the Products endpoint of the rest api. There are two endpoints dedicated to collections, Collection, and CustomCollection. The first one retrieves automatic collections, the kind that include products that have special tags or other criteria. CustomCollection covers collections where the products have been added by hand or by a custom app.

You can find custom collections that contain your product by providing the product id.

GET /admin/api/2021-04/custom_collections.json?product_id=632910392

If you are using the Shopify Rest API gem, this line of code will do.

current_collections = ShopifyAPI::CustomCollection.find(:all, :params => {:product_id => shopify_product.id})

This also works for the collect API as well.

GET /admin/api/2021-04/collects.json?product_id=632910392

And here’s the ruby code for that operation.

current_collections = ShopifyAPI::Collection.find(:all, :params => {:product_id => shopify_product.id})

Now that you have the JSON data back from the API, you can pretty much do what you like with it. You can put the collections in separate lists, you can combine them, or you can cross-reference it and remove the product from collections it shouldn’t belong to.

I hope that allows somebody to take little bit more control of their Product Data. If you want to get more tips like these, feel free to subscribe to my newsletter!

What I do in 2021

As part of my 30×500 coursework, I’m supposed to be building clout with my audience by posting educational content. Since already kind of have an audience (Hello, you!) I thought it would be kind of jarring to just start posting random e-commerce advice. Kind of like when people go from posting about their kids to posting about weight-loss supplements? So I’m just going to give a bit of context and talk about what I do for work these days.

Programmer is one word for what I do, but that covers a lot of different jobs I’ve done. I’ve worked on crime mapping programs, soil databases, school enrolment systems, and online car advertisement systems. Each project involved learning new techniques and facing new challenges.

Nowadays, I run a website called Fire-parts.com. It’s the largest online retailer for gas fireplace parts in the US and Canada. I started off working on it as a contract for a previous job, but now I work on it full time.

It’s powered by an e-commerce web software package called Shopify. If you shopped online outside of Amazon, chances are you’ve used it yourself. There are open source software packages like Magento and Woocommerce that you can install yourself on your own rented server, but they require a lot of little tweaks to get working properly. Shopify handles a lot of those features all by itself.

It also has the added benefit of not having as many heavy handed merchant standards as platforms like eBay and Amazon. Although Shopify allows you to connect to those platforms, Amazon in particular has been known to severely punish merchants who ship items late or run out of stock unexpectedly. Getting back online involves a lengthy process of writing letters detailing your process and how “this will never happen again, Mr. Bezos sir”. With Shopify, such matters are settled between you and your customers.

Does it have its limitations? Sure it does, but you can work your way around most of those by using their app platform. There are apps for marketing, product searches, user experience, and a whole lot more. You can even build custom apps yourself to really set your store apart from your competitors.

Fire-parts has one such custom app, and it’s the one that I spend most of my day working on. It’s a searchable database containing manuals for over 10,000 fireplace models. Whereever possible, it scrapes the manuals for part numbers, which we cross reference with our product database. When you find the manual you’re looking for, it will not only display the manual itself, but any instructional videos we have, related documents, and a parts list. Thousands of fireplace professionals all over North America use this system to find the parts that they need. My job is to add new features to this database so it has more models, more parts, a better interface, and a better search engine than any other competing database.

So that is what I do now. I have some special expertise, but I’m always looking to improve. That’s why I enroll in courses like 30×500. Another great way to improve your knowledge is to take what you know, put it in a new context, and help some people with their problems. People have lots of questions about Shopify, so I’ll try to answer a few on this blog and see how it goes. Of course, if you have any questions yourself, Let me know and I’ll try to answer them here too. And as always, you can join my mailing list and you’ll get the answers straight into your inbox.

How I’m doing Social Media right now

Like most people, I have a complicated relationship with social media. On the one hand, posting is free labor for multi-billion, growth-at-all-cost megacorporations that have left us drowning in misinformation. On the other, to put it bluntly, it is where the people are. So if you’re trying to build a reputation for a business or anything else, your only other option is a classified ad in the newspaper.

So I’m still taking the marketing course. That means I have to use my social media more often. What does that look like?

It looks like more posting on Twitter. The platform allows me to use automation services like buffer.com, and I can use their analytics to figure out what kind of content spreads. I get more engagement out of Facebook, but it’s more for keeping in touch with people I already know. Same with instagram. Those platforms also don’t allow automated posting, so I’ll be using them less often.

It also means a bit of Spring cleaning. I’ve been on Facebook and Twitter for more than 10 years, and I don’t need anything I said 10 years ago to embarrass me now. I also want to make separate online identities, basically having a public identity for stuff I create, and private accounts for stuff I consume. Not everybody needs to know I subscribe to wikipedia titles that sound like Teenage Mutant Ninja Turtles. I also want to stop following accounts that don’t follow me back. I’m trying cut down on the para-social relationships, you know?

Facebook and Twitter both offer options to download and archive your data. On Twitter, you can use tweetdelete.com to delete all of your tweets before a certain date. Deleting Facebook and instagram posts is trickier because they are more nervous about any automated activity on their site. Plus, they want to make removing your data as slow and ponderous as humanly possible.

When it comes to separating your online identities, you’re going to have accounts you’ll want to keep, accounts you’ll want to get rid of, and accounts you’ll want to follow on another account. To make this process easier, there’s a tool called Phantom Buster that will scrape all that data from your Instagram and Twitter and put it in a handy csv spreadsheet. Phantom Buster is capable of much more complex monitoring tasks, but if you just need to scrape a couple of personal accounts, their 14 day free trial is all you need.

It’s hard to believe after all this time we are still figuring out how this internet thing is supposed to work. What to post, where to post, and how to post is still an open question for most of us. I still think we adhere to the pareto principle here. 80% of the content is likely produced by only 20% of the users. So if you are taking the time to post essays, take photos, or anything else on the internet that’s not consuming, you are already part of an exclusive club. I hope I’ve shown you some tools that can help you manage your online identity in a way that makes you feel comfortable. At its best, social media can help people build communities that just aren’t possible in the real world. I hope to be speaking with more of you out there really soon.

Again, if you want to see me write more without the social media companies getting in the way, you can always subscribe to my mailing list. I’ve figured out the mailchimp templates this time, I promise!

I’m in 30×500!

In a world of sweeping societal change, deadly pandemics, and the creeping spectre of climate change, what can a man do to better himself, his loved ones, and civilization itself?

Well, this man took a marketing course on the internet. Sure, there are worse things I could be doing. I could’ve been renovating and flipping houses, for instance. I admit it’s an underwhelming outcome, but when there’s so much uncertainty, you have to invest in the one resource that’s actually in control: yourself.

I picked a course called 30×500. It’s run by Amy Hoy and Alex Hillman, two very prominent people in my industry. They call it 30×500 because if you create a book, a podcast, or software that 500 people will pay $30 a month for, it works out to $15,000 a month, which is not a bad living.

I’m not sure I’ll make that much. In fact I’ll be ecstatic if I make the tuition back. What I’m really excited about is all the structure that I’ll be giving to all these side projects I’ve had over the years. I’m like most creative people. I come up with ideas constantly, but I don’t have a framework to execute it or get the kind of money to keep working on my ideas. The “30×500 approach” involves choosing and studying audiences so I can come up with the kind of ideas that will provide value. So, I can keep looking for shiny new things to work on, but this way I can find ways to justify them.

You can find out more about this course at stackingthebricks.com. Of course, I’m not just telling you about this because you’re all smart people and I like you. This is course work! I need to tell my audience (that’s you) about all of these new projects that I’m doing if I ever expect them to launch. That’s why I’ve now got a mailing list. I will need you to head to www.james-strocel.com and enter your e-mail into the sidebar. That way my blog posts will head to your mail box no matter what the algorithms on your social media have to say about it. Thanks in advance!

Processing…
Success! You're on the list.

Do it for the attention

Sometimes when I’m writing, I ask myself, am I only doing this for attention? It’s a scary thought. I want to entertain and inform, but maybe I’m just trying to fill some unmet emotional need. Writing does make me feel like I’m being listened to, but then why do I have to go post it all over the internet like I’m somebody special? Why do I have this wish that it reaches more people, that it turns into some kind of multi-million dollar book deal with a fully catered speaking circuit? That’s because the answer is, yes, I am this for attention. We are all doing this for attention!

I live in a community full of wonderful, creative people. Artists, musicians, photographers, costume designers, models, actors, film directors, interior decorators, I can count the whole gamut among my friends. I think it’s great to see their work posted online, but I feel like our bespoke media landscape could be more crowded. I think this is because a lot of us are afraid of being branded as attention-seekers.

As a rule, people don’t like attention-seekers. That’s because to seek attention is to seek power, and to seek power is to seek domination, and people, if they can help it, don’t like to be dominated.

However, there is a problem with this rule. Attention is a human need. If we don’t get attention, we die, full stop. Businesses without attention cease to be businesses. Without attention, we can’t get food, shelter, or other necessities. We go crazy from the loneliness. This is why some societies use shunning as a form of punishment. It’s unpleasant and possibly deadly.

Attention is a human need, but if we try to go out and get it, we run the risk of being rejected. So what’s the solution here?

I agree there’s no easy answer to this. We have to constantly modulate how we are getting the attention, who we are getting the attention from, and what kind of attention we are getting. But the one thing we need to stop doing is arguing with our need for attention. We all need attention to live and to fulfill our dreams, so we all need to figure out how to get it.

If we are all trying to reach our goals without attracting too much attention, we set ourselves up for failure. We keep secrets, we get distracted and we pass up opportunities. We stop interacting authentically with ourselves and our community.

The impulse to humility is a coping strategy we usually pick up as children. It doesn’t have anything to do with the here and now. It’s a hard lesson to unlearn, but it’s worth overcoming.

Worst of all, if we decide attention-seeking is for other people, we let people who are narcissists, who are unscrupulous, who would dominate other people, compete for headspace in our community unchallenged. You may think that silence is golden, but in the wrong circumstances it can also be violence.

So I implore my creative people, let the world know what you do. Post your art, your writing, your costumes, your music. It doesn’t have to be new, it just has to prove you exist. We are all trying to survive in a harsh new world, so let’s declare a moratorium on denouncing attention seekers. Instead, let’s seek some attention of our own.