Checkout Toolbox

Flex Theme Sections

Linear Shopping Experiences

Bulk Editing Product Templates in Shopify

Changing the product template on 1000s of products at once is not easy in the Shopify Admin.  Here's a process for doing it using the Shopify API and Postman.  It's a bit technical, but much easier than doing it in the Shopify Admin.


Video Transcript

Hey, Scott Austin here from Jade Puma.

In this video I'm gonna talk about a postman routine that I put together today. The problem I came up with was changing product template in bulk is not an easy thing to do in Shopify. You can't when you export products and you, you can edit, you know, product things like product type, description, images, template's, not in that list. When you do an export from Shopify. Now there are apps that let you export the template and you can edit the, you know, the template there. But in Shopify, the way they want you to do it in, in the Shopify admin is in bulk edit. So lemme just show you what that looks like and how much of a nightmare that can be. So, and, and the problem I have is we launched this new design today for FL and b fine learning and Bath.

And it has this pretty intricate product form for be, you know, you can switch between different ways to order, You can filter by different things. We bucketize the varis you can and all, all sorts of fun stuff. And the problem is for fine learning and bath, they have 3,200 products in their bedding category. So what I had to do today was change the product template for 3,200 products. And you know that that can take a long time. If you do it manually, it'll, it'll take forever, obviously. But here I am in fine linen and bath Sepi admin, right? And what I could do is I could go to products and I could find all of the products in the collection betting done, and then you could select them and say, I want all of them. Now there's 3,200 products in this. And then if I go to edit the products, I've got to change the columns to show template.

And unfortunately, when you get rid of all the other columns, it still leaves all the variance in the display. So it ends up taking, and some, some of these we can't see it yet, but some of these products, and you see here, now we're gonna load up some more, right? And it's doing it in chunks of 50 or a hundred, whatever the number is. Some of them the pro, here we go, the product start having more and more variance. So in one page view, you only get one product to show up. So it becomes really difficult in this to change them. Now I, you know, in theory what you could do, if the variance weren't there, it would've been easier. I could just select this one and this one already has the the template that I want

And I could just drag that down to all the other ones and it would change them. But what happened is I started doing that is as I started up loading up more and more products, you know, sometimes there's only one per page, so you just click on it and it takes forever to select them. But then loading that many products, it takes a long time to load. And then it would just crash on me every once in a while. And sometimes it would only crash when I tried to save. So, you know, you'll sit here for, you know, half an hour doing all these little things that I'm talking about, hit the save button and nothing happens. It just, you know, starts spinning and all and, and you're like, you know, lost so you lose a lot of time. So I didn't trust the reliability of the Shopify Bulk editor to do the work that I wanted to do with thousands and thousands of products.

So instead I said, Well, is there a way that I can do this in Postman? Now I've done a Postman video before and I'm gonna assume you've watched that already cuz it has some foundational things that I'm not gonna go over. I'm just gonna show you how I got Postman to work for changing product templates. So I'll have a link in the show notes or the, the description to the other video about Postman if you haven't seen that one before. So what I did today in Postman is opened it up and I added fine linen and bath as an environment right here. And what that does, you, you know, you gotta create a private app inside of Shopify and then take your app credentials, username and password and add them as an environments. And I cover that in more detail in the other video, right?

So that, that was done. And then up in collections, I created one today for fine linen and bath. In the previous video I talk about how you can get this Shopify from Postman section with lots of templates on how to do API calls. So I looked in the product ones, actually just copied the product one and brought it up to fine linen and bath and I've deleted all the entries I didn't use, but then I ended up keeping three of them, right? The first one was, you know, retrieve account of products. And it, it's nice because this, this was just, I pulled it straight out of that template from the Shopify for Postman stuff and I could just, you know, under parameters, I checked the collection, Id put in the collection I wanted, which is the betting one, and then I could just send and it would come back. That's not the betting one, that's a different one with 172. So if I do the betting one, let me just do that, find that collection id. So I'll show you where collection IDs come from and the Shopify admin, all you have to do is bring up that collection inside of the Shopify admin and then the URL is where you'll see

The id. So if I go to be right here, the URL ends with the collection id, so I can just copy that and put that in here. You can tell how long that collection's been around by how few characters that collection Id has save that and now run it. And then that's 3,600. Because it also has a lot of draft of fi I said it was 3,200 and when I looked at it on the front end of the, the Shopify store, there's 400 products that are in draft mode. That's why there's 3,600 total. So that was my way to see, you know, how many products were in there was easy to do. I didn't, I only used that once or twice. Then I used this other one Retrieves a list, retrieves a list of products. And this one I, I played with a lot.

So one of the unfortunate things that I found out is, and you can see it right here, maximum two 50. So the limit of how many products you're gonna pull the Maximus 250. Now I got 3,600 products. So obviously there's a problem there. So you know, I'll show you how I ended up, you know, working around that. And then on this one here, here's our collection id. The product type is redundant with collection id, I was trying different things, you know, just searching all products for product type. I didn't end up using that in the end. So I'll just move that down. I use the collection id and then I actually add two field entries cuz I wanted to be checking every once in a while. You see what happens if I just send this one off?

Oh I, I've got the sensed so I gotta turn that off and it send, so I'll make sense in a second. So here I would query for 250 products cuz that's the limit you can do inside a Postman, which is probably a Shopify API limit. And if you actually do it higher than this, right? Watch what happens if we say, well let's just do 300, we'll send that off and you'll get the error back. You know, limit exceeds the two 50. So we gotta respect that two 50, send that off. And then the fields here, right? This is just saying which elements about the products do I want back? And I wanted ID and template suffix. So here you can see here's the ID for the products and the template suffix. And that way I was able to see oh these ones do need to be changed or no, it looks like all the products, you know, have the right suffix.

And that's why I made two field entries. Cause when it came time to cutting and pasting, which I'll show you here in a second, I just toggled between the two and hit send and now it just has the IDs. So having two field rows here and toggling between one and the other is a nice way for me to say, well I want to check more information. So let me show that bigger list. But when it comes to cutting and pasting, I want a shorter list of information and I can just toggle back and forth between the two of them. So what I did is I pulled this in, now I got 250, I pulled them and I hit control A to select all copy. And then I opened up a Excel spreadsheet, which I had named Product IDs. I'm just gonna open up a new tab to show you what I did. And I just took this in here and I pasted it. And then over here on product IDs, I'm just gonna copy this header cuz you, you need a header at the top of your list and I'll show you how I process this in a second. It's really easy to just make it a a list of the ID numbers.

So what I was trying in the beginning was saying, All right, show me only products with a certain template suffix, which is nice, right? So I can say, show me products with the template suffix of bedding and send. And let me actually just toggle between the other field, which shows the suffix, the template suffix. And you can see they all say betting. Now if I said show me all the products of the template suffix test, it came back with all the, you know, all the, the be ones. So I'm not sure cuz I added this template suffix key here you can see the ones that came from the Shopify from Postman templates. Those are the ones with a description on them. The other ones are the ones I, the ones with the blank description I had. So what I was trying to do was see if I could just filter for products with a certain template suffix, cuz that would've made this step, this process easier for me.

Cuz what I could do is pull down 250 of 'em that aren't, you know, template suffix of betting. If I could just say, you know, default or no or whatever. But that wasn't working. So it was an idea that I had. Hopefully if you're doing this, you can figure out how to get that to work. Cuz that way I could have pulled two 50 down that weren't betting change them, which I'll show you here in this, this put up here, change them to what, you know, I wanted 'em to be betting and then go back and run it again and would get me the next 250 that don't have the right template assign to it. But that didn't work. So what I had to do instead was pull this, this first

250 down and then take the very last ID and copy that. And then there's a, a key here for, since ID, which restricts results to after a specified id. So then I just took that, pasted it in and then hit send. And that would give me the next 250. I would do a control a, Oh, let's use the other field entry, send, click down to the lower area, control a copy, go into my spreadsheet, go to the last item by hitting control down arrow and then paste again. And now I've got 500 of them listed and I did that until I got all 3,600 in my, my spreadsheet. And that's this list over here. So then the next thing I did, so let's assume I've done that however many times I have to do, get all 3,600 in here. Then the next thing I did in this spreadsheet was, and this becomes a little finicky, right?

Because what happens is, and you can see it over here, and I, I like I ran, ran this, uploaded it into the next step. I'll show you where you, you go in and do your puts and your your postman API stuff and I would be getting like 50 of 'em working properly and 200 not. And I realized in the end the cause of that was exactly what we see here. Where for some reason Excel tries to be smarter than I think it should be sometimes. And this is one of the examples of it where this number here, I wish it would just show this number in this cell over here. Instead, it shows this stupid exponential format thing. And you'll see here that in my format cell it says general. But it does that exponential thing when there's long numbers by default. And that ended up screwing up my CSV file cuz Excel knows what that is. But when the CSV got saved, the CSV then saved that as a 7.1 0 4 0 0 0 0 0 or something like that. So all my IDs were getting lost, right? So, so the the next step I'm gonna show you here, and the other tab was an important one. So what I did here is just sorted this from go to data view and sort from Z to A and then just took the first, you know, hundreds of rows here and deleted those.

And then I took selected all set it instead it general, I said it to be a number right here number. So I'm defining this as a number and then I went in and copied that all the number of spaces, right? And then select column A again, hit control F to get my fine menu paste in what I just copied, hit the replace tab, I'm gonna co replace it with nothing. So just leave that blank and then select replace all. So now it just made 500 replacements and that math works out, right? I, I ran 250 twice, so I've got 500. So that's, it's good that my numbers are matching there and now gonna take my number and I'm going to reduce my decimals and then save this as a CSV file. And I'm gonna close this file out and not save it. Cause I don't know if these will be corrupted or not.

Now that I opened it up in Excel and it's gone to this exponential formatting thing, even though on that tab I had done this and, and defined them as a number, it still does. Like I said, I think Excel tries to get too smart sometimes. So that's just something you're gonna have to work with and make sure you don't, you know, mess that up. So let's close that out and not save. So now what, what you should have done by now is gotten a list of all the product IDs that you want to change your template on. And you've got those in a CSV file that only has at the, the very first row, the product underscore id header and then just numbers below it for however many products are going to change the template for. And then you go to the, the put, right?

So in the Shopify from Postman templates under products, there's products, right? There's a put, and I just use this template and customized it for what I was doing. So what we did here is I added this body of, so we're not using parameters in this one, we're using the body method. And I don't know why, I don't know Postman well enough to know why this works versus the parameters. But in the body, I just did this, this code here, and you can see we're taking the product id. Now the cool thing here is here you can see the API key, right? It shows you where it's coming from, the environment. So that was over here in my environment under fine London and Bath. I have an API key and I'm not gonna show that that screen to you because it shows both my username and password, which you could use to access the store.

And I, I just don't want that information out there, right? Keep this store a little secure. But as you hover over each of these variables, it'll show you where that information is coming from. Environment API version. Now the API version, I have that set up as a global setting, and right now the current API version that Shopify is using is 2210. You can see right there. But as you're in these elements, you can see where your, Let me just get back to my collections put, here we go. You can see where your, sorry, I'm just closing out extra stuff. So here you can see where these elements are coming from. So the API versions coming from your global settings, the store name is coming from your environment. Now, if we go over to Product id you can see here that you know it, it's not defined anywhere, but that's where we define it here. We say, All right, we're gonna pull that product id. And in that product ID we're gonna change the template suffix, which is the, the API name for the template. So that's basically everything after the product, right? If you look inside the Shopify admin that we have under the code, right? Let's just show it to you.

If we go to a product here and you look under templates, right? Be there's default bedding, you know, and all these other ones we've got. So the be that is the the template suffix or suffix template, whatever it's called here, Template Suffix. So we're telling it, Hey, take this product ID and then change the template suffix or set the template suffix to betting. And if it's already betting, it'll just, you know, do the same thing. And then I also had to set up a test and the template that you get from Shopify, from Postman down here, it doesn't have tests set up. So I talk about that in my previous video. It took me a while to figure it out. But you know, this one here was the test I needed. I had copied from a previous recipe that I had done before, and in that one the status was 2 0 1. So I, I copied and pasted in here and I still get an errors when I ran it. And let me show you what that looks like when we get an error. Well, we'll, we'll, we'll do a run in a second and then I'll show you the errors there. And then I figured out, oh, it's looking for the status response of 200. So I, I changed the code to from 2 0 1 to 200 and that's working good now. So how do we run this now

For 600 products? What we have to do now is go into our runner and the runner is down here, this little button down here, Runner. So we open up runner and we pull in the put drag and drop and it brings in everything in the same folder. Now I don't need to run the get a whole bunch of times, so I'm gonna turn those off. We're just gonna run the put. And then over here we have to select a file. So we made that CSV file. So here we're gonna bring up the CSV file, which was product IDs csv. And here it knows that it automatically just called up 3,680 records in that file. So that's a nice check also that yeah, that sounds like about the right number of products that we're gonna be uploading. So you know, the file loaded up properly, right?

And then I also set a delay on this. I ended up getting a lot of four oh fours and that, that ended up being, because the issue with the product IDs with that scientific notation and Excel messing things up, things were coming back as four oh fours. I didn't realize that at the, at first. And then I was getting 4 29 errors and things like that. So I thought maybe I was inundating the api. So what I was doing was I said, All right, I'm gonna put these a hundred milliseconds apart which is like a 10th of a second I think. So, you know, you probably wanna set a delay anyways. And it ended up, it wasn't the a delay that was causing my problem, it was my scientific notation issue with Excel that was causing the problems that I was having.

But I ran this just an hour or two ago, or a couple hours ago, and it took two hours to run at a hundred millisecond delay with 3,600 products. But the nice thing is as it runs that, you know, it just, it Postman just runs it and you can watch it or just put it, you know, in, in, in another screen and go on with your work. You don't, you don't have to sit there and watch it run. So if we hit run fine linen and bath, right? So you'll see it, it's gonna start working. So pass, pass, pass, you see the status up here and it shows you what's going on. So this is a nice verification that it's working. I'm gonna stop the run. I'm gonna go back over here and show you what happens if you have the wrong code in there, save that, and then go back to here and run again. And now we're getting this error, you know, expected status, error code 2 0 1, but got a 200. And that's when I realized, oh, okay, I'm gonna change this from 2 0 1, which I had for another recipe to 200

And go back to the runner and run again and it'll work. So, you know, just showing you some of the problems that I had in case you see something similar. So you just let that run and now you'll have all of your product templates get updated. And now the nice thing is I've got this recipe set up. So the next product that your product type in, in the fine line and bath storm we work on are bath products, right? So just do the bedding ones. And when I do bath, I'm gotta make a new template for the bath products. And then now I'll be able to easily come in here, find all my bath product product IDs, and set it up to change the templates to the new template that I'm gonna make. Product dot b for all the bath products Soly. This gives you an idea of how you can use postmen to do bulk editing of product templates.

Thanks for watching.

JadePuma is a certified Shopify Expert. If you need any help with your Shopify store, we can help.