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

Shipments documentation #2353

Merged
merged 12 commits into from
Jan 2, 2018

Conversation

benjaminwil
Copy link
Contributor

I am taking the shipping guide documentation merged in #1966 and I am breaking it into several articles about shipments. My goals are to:

  • Give more context to Solidus's basic shipping concepts. Developers who are new to Solidus should be able to understand shipments flow from a business perspective and then a development perspective.
  • Use article titles, headings, and sub-headings to make it easier for developers to discover the specific information about shipments that they are looking for. They should be able to skim and scan each article quickly.
  • Provide more realistic examples of how shipments might be set up in a store. Use zones, shipping methods, and shipping categories in the same way a successful ecommerce business might use them.

This PR splits the guides/shipping.md article into multiple guides/shipments/*.md articles. Much of the content has been rewritten and all of it has been reformatted.

The most remarkable changes are the the "Shipment setup examples" and "Split shipments" articles. I wanted to create more realistic shipment setups, and as of #2199 (Solidus v2.4.0) split shipments use the Spree::Stock::SimpleCoordinator instead of using coordinators, adjusters, packers, etc.

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 you want to add different splitters for each of your `Spree::StockLocation`s,
you can decorate the `Spree::Stock::Coordinator` class and override the
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is an old reference and should be updated to Spree::Stock::SimpleCoordinator.

Copy link
Contributor

@mamhoff mamhoff left a comment

Choose a reason for hiding this comment

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

I have, again, nits. There is still some stuff from the old guides in here that flat out would not work in a current Solidus store ("Calculators take an array of line items").

I think those bits should either be deleted or significantly revised, but that can be done in subsequent PRs. Hence: 👍

`Spree::Order`'s' state is set to `delivery`. This occurs before the customer
has completed their order at checkout.

The simple coordinator deletes any existing shipments for an order and then
Copy link
Contributor

Choose a reason for hiding this comment

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

That's technically not correct. The coordinator only builds shipments for an order, the deletion happens in code that calls the coordinator.

Maybe instead:

The SimpleCoordinator takes an order and builds as many shipments as are necessary to fulfill it.

The simple coordinator performs a number of tasks in order to create shipment
proposals:

1. The coordinator calculates the availability of the ordered items.
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't calculate, just checks.

In order to split shipments, Solidus runs a series of splitters in sequence. The
first splitter in the sequence takes the array of packages from the order,
splits the order into packages according to its rules, then passes the packages
on to the next splitter in the sequence.
Copy link
Contributor

Choose a reason for hiding this comment

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

For each shipment that is thus generated, a shipping method is chosen. (this is to clarify that the splitting does not have anything to do with how the shipment is packed or shipped, instead the shipment is actually split in two separately fulfillable entities).

- [Shipping category splitter][shipping-category-splitter]: Splits an order into
packages based on a product's shipping categories. This means that each
package only has items that belongs to the same shipping category.
- [Weight splitter][weight-splitter]: Splits an order into packages based on a
Copy link
Contributor

Choose a reason for hiding this comment

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

...into shipments...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this!

package only has items that belongs to the same shipping category.
- [Weight splitter][weight-splitter]: Splits an order into packages based on a
weight
threshold. This means that each package has a maximum weight: if a new item
Copy link
Contributor

Choose a reason for hiding this comment

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

...shipment...

weight
threshold. This means that each package has a maximum weight: if a new item
is added to the order and it causes a package to go over the weight threshold,
a new package is created. All packages need to weigh less than the threshold.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/package/shipment.

While in the code, the thing is called a package, the end result is a new shipment. Package sounds like we're referring to the boxes inside the shipment, but we're not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't 100% clear on this distinction until you brought up Spree::Stock::Package in a comment. I've made a to-do so that this article would clearly make a distinction between packages and shipments. Thanks so much for your reviews.


<!-- TODO:
Give more context to the code block above. Would you/how would you
practically use this in your app? -->
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just remove this section for now. solidus_active_shipping is a beast, and hard to customize or understand...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ended up removing most of the content under the "Match the delivery service's provided name", but do you mean this whole article?


## Custom calculator requirements

Your calculator should accept an array of `LineItem` objects that are associated
Copy link
Contributor

Choose a reason for hiding this comment

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

The calculator takes a Spree::Stock::Package object, not an Array of line items. That object has access to the package.order and through that to all other stuff in the order.

However, when dealing with the contents of the package (that really is a shipment), as a developer you must deal with the package.contents array. If your store does split shipments, you will otherwise quote the entire order when you only want to quote the contents of one shipment of many.

"USPS Bogus First Class International"
end

def available?(order)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is old code that would not work in current solidus versions. The available? method now takes a Spree::Stock::Package.

cost and add tracking codes when editing an order. They can also perform other
tasks, such as splitting a single shipment into multiple shipments.

In the Solidus demo store, edit any order (from the `/admin/orders` URL) and go
Copy link
Contributor

Choose a reason for hiding this comment

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

For completed orders, the shipments tab is the default interface. It might feel confusing to users if they think they have to navigate.

@benjaminwil benjaminwil force-pushed the shipments_documentation branch 2 times, most recently from eab5fd9 to b4026c6 Compare November 19, 2017 20:00
@benjaminwil benjaminwil mentioned this pull request Nov 21, 2017
I intend to split the shipments guide into multiple articles. This
would be the first of many infrastructural changes to the Solidus
guides.
This article revises the documentation for split shipment management
in Solidus, which changed as of Solidus v2.4.0. See solidusio#2199 for more
information.
This commit removes the "Advanced shipping methods" article from the
shipments overview and replaces it with a more focused article about
creating custom shipping calculators. The other information that
appeared under the advanced shipping methods umbrella will still appear
in the overview article -- they'll just be moved around a bit.
Adds short introductions to inventory units and cartons. Also adds an
article stub where we should go into more detail about carton usage.

This article provides a summary of shipping concepts. If you are interested in
reading about example Solidus shipment setups see
[Shipment setup examples](shipment-setup-examples.html.markdown).
Copy link
Contributor

@afdev82 afdev82 Dec 7, 2017

Choose a reason for hiding this comment

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

This link is broken, or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this @afdev82. Should be shipment-setup-examples.md. I will push an update soon.

address, what shipping method is being used, and so on.

If your store has complex shipping needs, you may find one of Solidus's existing
shipping extensions, like [`solidus_active_shipping`][solidus-active-shipping]
Copy link
Contributor

Choose a reason for hiding this comment

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

Also this link seems to be broken

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

Thanks to @swcraig and @mamhoff for additional feedback on my shipments
documentation PR. For the most part, these edits address the need to
differentiate between "packages" and "shipments", especially when
talking about Solidus's split shipment functionality.
@jhawthorn jhawthorn merged commit f0b2e04 into solidusio:master Jan 2, 2018
@benjaminwil benjaminwil deleted the shipments_documentation branch April 30, 2018 18:28
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.

None yet

5 participants