Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Products and variants documentation #2437

Merged

Conversation

benjaminwil
Copy link
Contributor

I've rewritten the existing products and variants guide. It's been split up into multiple articles. Some of them, especially the "Multi-currency support" article, are stubs anticipating growth.

Summary:

  • I more explicitly reference the roles of each Spree::Model that is essential to setting up Solidus products and variants.
  • I use more subheadings to help readers find what they need more quickly.
  • I tried to point to a single example throughout all of the articles. (A store that only sells mugs and t-shirts. In some cases, a limited edition t-shirt.)
  • I put all of the information about product images and Paperclip into one article about product images. This is in anticipation of Paperclip being removed from core. (See Add #gallery to Variant and Product #2337.) It'll make for easier docs maintenance later on.
  • Lastly, I made a quick-read overview for readers just getting started with products and variants. It attempts to summarize all the essentials and link to more specific articles when appropriate.

This is part a larger project to improve Solidus's documentation. See this gist with the high-level table of contents. Where and how this documentation will exist is still up for discussion.

-->

If none of a product's `Spree::Variant`s have a price value for the site's
configured currency, that product is not be visible in the store frontend.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not be visible

## Product properties

You can also configure products to have [product
properties](product-properties.md) Product properties allow you to add custom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be two sentences?

@benjaminwil benjaminwil force-pushed the products_and_variants_documentation branch from 02e08e1 to 061265a Compare December 13, 2017 00:55
You can see a product's price in the store's configured currency by calling the
`price` method on that instance:

```shell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ruby rather than shell.

If none of a product's `Spree::Variant`s have a price value for the site's
configured currency, that product is not visible in the store frontend.

You can see a product's price in the store's configured currency by calling the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're talking about variant's above, but products here. How does this work?

`Spree::Variant` models depend on each other, it is important to understand how
they are different:

- `Spree::Product`s track the general information about a product. This includes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're talking about products and variants here using the same terms. I think it would be best to start with examples of cases where a product has variants, and what the product is and what the variant is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are very right. I've extended the products and variants bullet points here.

product. The variant stores the product price, dimensions, and weight. The
variant provides the information required by orders and shipments.

The `Spree::Variant` model provides the price for each line item in an order.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the price do that?

a t-shirt, you would set up a product for each of them.

If you have a number of items that are similar (like t-shirts that come in
small, medium, and large sizes), you can create [variants](#variants) for a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This information should come first to provide context about the information listed above.

dimensions, and other properties.

Line items use a `variant_id` to associate a variant with an order. So, every
product has at least one `Spree::Variant`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a good point to bring up master variants.

a variant.
- `cost_currency`: Set an alternative currency for your variant.
- `cost_price`: Sets the price for the variant if it uses an alternative
currency (`cost_currency`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sets the cost price even if it's not in an alternative currency.

can set positions by drag-and-dropping any variant in the list of variants on
a product's **Variants** tab.)
- `track_inventory`: Set whether inventory should or should not be tracked for
this variant.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean?

a product's **Variants** tab.)
- `track_inventory`: Set whether inventory should or should not be tracked for
this variant.
- `tax_category_id`: Overrides the product's tax category for this variant.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

item.
- If a product has more than one variant, then the master variant does *not*
provide the price and other properties to the line item. Instead, it is used
as a template for other variants.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I have a red shirt, and a green shirt in small, medium, and large. What should my master variant be?

Copy link
Contributor Author

@benjaminwil benjaminwil Jan 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I know the correct answer to this. If the red shirt only comes in one size, then it should be one of the green shirts. Right?

Would it be best practice to assign the master variant to the "lowest common denominator" between the shirts?

I started working on an example with mugs:

The master variant should be the "lowest common denominator" between all of your
variants. For example, if you have five variants on your mug product that have                                                                                                       
option types of "Color" and "Size", as well as different prices, it would be
advantageous to set the master variant to the variant that has the most common
color, size, and price.


| "Mug" variant | Color | Size    | Price |
|---------------|-------|---------|-------|
| 1             | Green | Regular | $12   |
| 2             | Green | Large   | $14   |
| 3             | Red   | Regular | $12   |
| 4             | Red   | Large   | $14   |
| 5             | White | Regular | $12   |

In the table above, the "Mug" variant 1 or 3 would be appropriate master
variants. This is because the majority of the variants share values with them
("Green" or "Red", "Regular", and "$12"). 

Copy link
Contributor Author

@benjaminwil benjaminwil Jan 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But beyond what the master variant "should" be, I also added this information to the "Master variants" section:

By default, the master variant is the first variant created for a product.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: Gregor and I chatted privately and sorted this out. Silly me, generic master variants are the way to go.

@benjaminwil benjaminwil force-pushed the products_and_variants_documentation branch from 061265a to a581055 Compare January 11, 2018 17:39
@benjaminwil
Copy link
Contributor Author

@gmacdougall Thank you for your review. I've addressed all your comments. Next time you have a chance, could you re-review my changes?

Copy link
Member

@gmacdougall gmacdougall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements to this. This a great step forward.

@jhawthorn jhawthorn merged commit f9be056 into solidusio:master Jan 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants