When loading checkout, it’s possible to add items to the cart directly from the URL (plans, non-plan products, or renewals). This mechanism has several places that it can fail, but none of those failures generate an error that the user can see. This is most noticeable when the cart is otherwise empty because then one of these failures will result in a silent redirect to the plans page with no explanation.
This PR displays those errors to the user instead. It also prevents the redirect if an error is being displayed (just like other errors).
In addition, this PR records those errors to Tracks and to Logstash so they can be examined later.
(As a side effect of some of the refactoring here, usePrepareProductsForCart now will never change its returned products once they’ve been created. This should have no noticeable effect but is more efficient and should help with other hooks that depend on its return value.)