-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Use order shipments #1651
Use order shipments #1651
Conversation
app/assets/javascripts/darkswarm/controllers/checkout/checkout_controller.js.coffee
Show resolved
Hide resolved
These rely on order.shipping_method which needs to be replaced with order.shipments.shipping_method
Now we only clear the order's shipping_method, and in Spree 2.0 it can have many shipments.
bd04acf
to
8ae36c9
Compare
As so far we're only returning a single shipping method id, we get it from the last shipment in the order.
This again gets the shipping method from the last shipment. It also extracts partials for delivery and pickup shipping methods.
0ab4ace
to
4fafd25
Compare
4fafd25
to
b353d7a
Compare
def shipping_method_id | ||
return unless object.shipments.any? | ||
object.shipments.last.shipping_method_id | ||
end |
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.
Maybe we can add some documentation here explaining why we need this and maybe telling that in the future we should move from order.shipments.last
to something more robust
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.
Agree on the doc adding a TODO. I want to abstract order.shipments.last
somehow.
end | ||
end | ||
end | ||
end |
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.
😍
This also needed for the Spree upgrade |
we totally change the way we deal with the spree upgrade since this was open, so no reason to still exist. |
@sauloperez Is this a good example of where we could test the ideas talked about today in the Spree Upgrade meeting? So reimplementing the current API for |
Yep! we could work on this one with @luisramos0 |
ok, I have reviewed all commits here and created issues for each part. |
This is a work in progress to address what we agreed on in https://community.openfoodnetwork.org/t/shipping-rate-model-step7/985/2
The goal here is exactly that: not to use
order#shipping_method
anymore and go throughorder#shipments
instead.TODO
order.shipments.last
How is this related to Spree upgrade?
Order#shipping_method
is gone in Spree 2.0, so any line of code that uses it in OFN will fail. We can provide the same behaviour but being spree-2.0 compatible without having to wait for a specific spree-2.0 branch 🤘You can get further details in https://community.openfoodnetwork.org/t/order-model-step7/979?u=sauloperez