Organizing Products in Spree Commerce: Part One

Isaac Freeman
Sep 18, 2014

Spree Commerce extends the intuitive idea of a “product” with a set of more abstract concepts: Variants, taxons, properties, options and prototypes. We'll show you how these concepts relate to each other and how you use them to build a store that’s easy for customers to shop, storekeepers to manage, and developers to maintain.

Products and Variants: the main thing to know.

Suppose we have an online store selling emoji t-shirts. We have hundreds of t-shirts with different designs.

Emjoi T-Shirts

Generally speaking, most customers choose between t-shirts mainly by the design. In Spree, we’d treat each design as a separate product.

However, selecting the emoji design that best expresses their personality isn’t the end of the shopping experience for our customers. T-shirts also come in different sizes, colors and fits. A customer might come to our store to buy a mug-of-beer t-shirt, but what they actually put in their cart is a red XL men’s mug-of-beer t-shirt, or a small blue women’s mug-of-beer t-shirt. These finer distinctions define the variants of a product. Variants are the specific items customers actually buy.

We browse products, but we buy variants.

Spree Products-Variants

It’s worth emphasising this point: the specific items that people buy are variants, not products. As far as Spree is concerned, products are just a way of organising groups of related variants so it’s easy for cutovers to find the one they want.

Spree’s admin interface doesn’t always make the distinction between products and variants clear. It’s tempting to just make everything a product and ignore variants. If you do, however, you’ll make your store much harder for customers to navigate. Most likely you’ll also end up duplicating the idea by grouping products together in non-standard ways.

Understanding Variants

Every product in Spree has at least one variant. This isn’t immediately obvious.

Spree New Product

When you create a product in Spree, you’re actually creating both a product and a “master variant.” The new product form merges the information for the product and the master variant into a single form. The Name, Prototype, Available On date and Shipping Categories fields belong to the product. The SKU and Master Price belong to the master variant. Spree never mentions the master variant in the admin interface.

If you add variants, it becomes clear which fields naturally belong there: they’re the things you might reasonably expect to vary without changing the product. For example, if your products are books you’d expect to charge different prices for the hardback, paperback and ebook editions. Price, therefore, must be a characteristic that belongs to each variant, not to the product as a whole.

The most important field for variants is the SKU. This should be a unique identifying code you can use to reference each variant, so you can manage your stock, and fulfill customer orders.

Spree doesn’t dictate any particular format for SKUs – many merchants have existing systems when they start their eCommerce sites, and it’s best to stick with the identifiers already in use, especially if they’re defined by suppliers.

Spree even allows you to create a variant with no SKU at all, but we strongly recommend that every product have one.

Understanding Products

Products in Spree have two jobs. First, to group variants that belong together. Second, to store the information those variants have in common.

The product’s name and description are reasonably clear. Most often there’ll be a page for each product, so each product also has a slug to identify it. The slug is used to make a unique URL for the product – by default it’ll look like this:

The available on date gives you control over when the product will be on sale. If you leave it blank or set it to a future date, customers won’t see the product on the site.

Products can belong to taxons. Taxons (and the taxonomies they belong to) deserve an article of their own, but briefly they’re the categories and tags customers browse through to find your products. If you’re selling furniture, you might have taxons for dining room furniture, bedroom furniture and office furniture. You might also have tables, chairs, beds and desks. You could have taxons for different brands, price ranges, or any other way you like to organise your products. Taxons can be hierarchies of categories and subcategories, or flat collections like featured products.

Products can also have properties. Not all sites use these, but they’re handy if you want to provide a table of features.

Finally, products can have options (also known as option types). If you’ve felt like something is missing in the relationship between products and variants, options are the missing link.

In Part 2 of this post we'll explain Spree variants, options and prototypes. Don't miss it!

It's really not enough to segment groups. I feel there's been a bit of a shift to try and segment lists, but really you need to be doing it on an individual basis.

Fraud detection — we had a client that had a massive fraud problem. To give you an idea of the mindset of someone who’s committing fraud, if you have say 100 stolen credit cards, what you want to do is translate them into cash. So you look for items that are small and easily shippable, have high value and high resale value.

So I can go to a store that doesn't have very good fraud protection, buy a GoPro that's worth $300-$400. Maybe I buy 10 of them at once. Then I can put them into the secondhand market because I know I can get 80% of the value and the shipping is pretty cheap.

That's how to commit fraud — so don't do that! The way we detect fraud with machine learning is we take into consideration a lot of different data points about an order: Address verification (does the billing address match the credit card?). If you have a hundred stolen credit cards it’s going to be difficult to know the addresses unless you stole that information too.

Then there’s shipping. Maybe I’ve ordered in the US but I'm strangely shipping to Canada. That just might be an odd thing for some businesses. There are certain hints like that.

Another one I've seen is figuring out how old an email address is. If you're a fraudster you're trying to generate a lot of new email addresses that have no trace on the Internet before and try and make each order different.

Machine learning centers around wrapping up these different points, trying to figure out how dodgy an order is, and making a decision.

Pricing — that was interesting earlier about the pricing class and figuring out where you can decide on pricing. If any of you have used Uber (which I imagine most of you have) then you would have been subject to dynamic pricing. Uber is making a prediction on demand. If they predict the demand is going up in short space of time they slap a surcharge on you. It’s really annoying, but keeps the supply and demand level and optimizes their revenue.

Finally let's talk about abandoned cart emails. I'm pretty sure everyone knows what an abandoned car email is, but what's important is the timing. How long do you wait in terms of when you’re going to actually send that email? Quite often people put a personalized discount with their email and you know, some people need a little bit of motivation and sometimes need a lot of motivation.

You can treat that as a prediction task to figure out how much discount to give. Obviously you want to minimize the discount and maximize the number of conversions you get from those emails.

OK so this is obviously which is one of the largest online retailers. Here is their home page and I think one thing we can all agree on is this particular page has probably been iterated on and tested hundreds if not thousands of times to get to what we see today. There's a lot to learn about this particular page.

Aside from learning that I’m interested in running and coffee, what do you notice about this page? This is how I see it. I would guess that 50% or more of this page has come through some sort of machine learning algorithm. I'm talking about the sets of lists they’ve chosen to put here, the order of those lists, the items inside those lists, and the order of those items. Even the ads have probably been chosen because they think they’re going to be most relevant to me.

This is a really large company that has refined this page a lot and is probably making a lot of extra money by going through this process. But the thing is that machine learning is not just for the big guys anymore.

It wasn't too long ago that you actually needed a team of data scientists to run all this in production. It's unlike our day-to-day programming and can be quite complicated. Only big companies used to be able to access this.

This is a little comic I drew up to explain the barriers to entry. Here we have a very tall wall that most of us can't get over and when we have a look over the wall we see unicorns and amazing things on the other side. These big companies have private access and the resources to just be able to pick up this stuff. They've been getting the gains from this for quite a long time.

One solution we can all pick up and utilize today is predictive APIs. It's like a ladder in this situation. We’re able to encapsulate a lot of the complexities of machine learning and treat it as an API problem that you can integrate with. The complexities are handled for you through the API.

Join The Conversation

Share and start a conversation about this post

More On The Blog

Ready To Get Started?

Find out how we can help you achieve your goals by booking a free consultation today.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Brand Image