-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove "Add product" in admin order shipments page #3214
Remove "Add product" in admin order shipments page #3214
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This should close #3085. Thanks for picking up the work on this one @spaghetticode! 🍝 Since this does affect the UI, do you mind adding a screenshot? |
@jacobherrington thanks for the input, it makes sense 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @spaghetticode. 👍
As discussed during the Solidus core team meeting, before removing this functionality by merging this PR, we should provide an extension or similar mean that will allow users willing to continue to use this feature to do so. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for continuing the work.
6789caa
to
e181e0c
Compare
The test setup creates an order without any line items but a shipped shipment. This is not possible in real world scenarios and leads to false negatives.
We do not need to visit the "Cart" before we visit the "Customer" tab after removing the country.
Mutating the order on the shipments screen is not a good idea and leads to lots of bugs and confusion by users. Mutating the cart should only be possible on the cart page. This removes lots of old, hard to maintain Javascript as well.
Adding a product from the Cart tab brings the order to `confirm` state instead of `cart`, changing the label in the Payment tab.
e181e0c
to
fa59e21
Compare
Adding JS code that was removed with solidusio/solidus#3214
Adding JS code that was removed with solidusio/solidus#3214
@@ -18,6 +18,8 @@ | |||
<%= render 'spree/admin/orders/risk_analysis', latest_payment: @order.payments.reorder("created_at DESC").first %> | |||
<% end %> | |||
|
|||
<div data-hook="add_product_button" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd try to use a more generic name since other extensions could use this hook in other ways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kennyadsl makes sense 👍
I changed the name to admin_order_edit_sub_header
fa59e21
to
5b8b8fb
Compare
This hook is used by the `solidus_shipments_add_product` extension that brings back the "Add Product" link to the admin order shipments page for stores that need that functionality.
5b8b8fb
to
b06c385
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Can you please add the link to the new extension in the PR description, and maybe a quick recap on how/when to use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @spaghetticode!
Now that solidusio/solidus#3214 is merged, Solidus branch in the Gemfile must be updated to `master`. Until a new Solidus version will be released, only Solidus `master` supports this extension.
This PR is the continuation of the work started by @tvdeyen with #3099.
Please refer to that PR for motivations and previous discussions.
This is the admin Shipment page before the changes, when it's still possible to add a product:
This is the same page after the changes, when adding products is not possible anymore:
Of course products can still be added from the Cart page:
Retrocompatibility
Since some stores may want to keep the removed functionality, the code was extracted to the new Solidus extension solidus_shipments_add_product.
Usage is very simple, just add the extension to the Gemfile and run the installer:
The extension will work only on Solidus versions that include this PR.