Add CartInterface::queuedUpsertItem and CartInterface::route #135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cart item queuing is required to support email login after an "add to cart" button is clicked. It does this by making the add-to-cart POST routes accessible w/o requiring login. The controller for the post creates the cart item and then calls
queuedUpsertItem(...)
which will either add the item immediately, or defer addition by storing in session data until a user login even occurs. By redirecting to the cart (which is an auth protected route) after addition, the login page will appear when needed. And, because the cart is a GET and not a POST, laravel's redirect tointended
will work properly, showing the cart after email capture.