Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
Order
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Jul 2019 at 15:44 UTC
Updated:
10 Nov 2021 at 07:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
luksakHere is a first patch.
Currently the condition can only take the first shipment into account.
Comment #3
flocondetoileattached the same patch with some small improvements:
- removed unused declarations
- typo fix about $order vs $shipment
- prevent a fatal error if order's shipments are empty.
Comment #4
dwkitchen commentedUpdating to align with #3170419: Move all Shipping Conditions to the Shipping Category
Needs test before acceptance - can probably be replicated from
commerce/modules/order/tests/src/Unit/Plugin/Commerce/Condition/OrderBillingAddressTest.phpComment #5
khiminrm commentedAdded tests.
Comment #6
khiminrm commentedadded missed ShipmentAddressOrder.php file in #5
Comment #7
khiminrm commentedComment #8
jsacksick commentedI've been thinking about this... And actually, we could provide this from Commerce directly.
The problem is, we already have a condition for the shipment, that adds a "Shipping address" condition under the "Customer" category (which means, on the shipping methods admin, we'll end up with a duplicate "Shipping address" condition.
Commerce could offer an OrderShippingAddress plugin (or eventually reuse the same plugin for both the billing & the shipping address, using a deriver.
Commerce has a
collectProfiles()method on orders, that is what we should be using, and not get the address from the first shipment.Comment #9
jsacksick commentedComment #10
socialnicheguru commentedSo I better understand the "Shipping address" condition under Customer applies to the billing address?
Without the patch I get the following:
I am currently trying to restrict to a zip code.
If the billing zipcode that I enter is in the allowed zip code but the shipping zip code is not in the allowed, shipping is still allowed.
Comment #11
jsacksick commentedI worked on the new condition. The problem is... I'm no longer sur why we actually need this :), since the Commerce shipping module provides a condition already?
Comment #12
jsacksick commentedRefreshed my memory, commerce_shipping provides a condition that works for shipments.
Comment #13
socialnicheguru commentedUnder customer there is a shipping address condition.
Is that shipping condition applied to a customer, a person who has already purchased and has a saved shipping address on file? Can it be applied to anonymous users?
I do not know enough about the Customer shipping condition to know why this patch is needed. Or why the current customer shipping condition cannot provide a solution to what the person who posted this issue wanted.
Can anyone provide a little more guidance?
Comment #15
jsacksick commentedWent ahead and committed the patch.