mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Bypass validation of shipping methods zone on checkout
This commit is contained in:
@@ -53,6 +53,14 @@ Spree::ShippingMethod.class_eval do
|
||||
spree_calculators.send model_name_without_spree_namespace
|
||||
end
|
||||
|
||||
# This is bypassing the validation of shipping method zones on checkout
|
||||
# It allows checkout using shipping methods without zones (see issue #3928 for details)
|
||||
# and it allows checkout with addresses outside of the zones of the selected shipping method
|
||||
def include?(address)
|
||||
return false unless address
|
||||
true
|
||||
end
|
||||
|
||||
def has_distributor?(distributor)
|
||||
distributors.include?(distributor)
|
||||
end
|
||||
|
||||
@@ -41,5 +41,6 @@ FactoryBot.modify do
|
||||
factory :shipping_method, parent: :base_shipping_method do
|
||||
distributors { [Enterprise.is_distributor.first || FactoryBot.create(:distributor_enterprise)] }
|
||||
display_on ''
|
||||
zones { |a| [] }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user