Bypass validation of shipping methods zone on checkout

This commit is contained in:
luisramos0
2019-06-15 20:51:24 +01:00
parent e4fcaa5992
commit ccc7a43a06
2 changed files with 9 additions and 0 deletions

View File

@@ -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

View File

@@ -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