diff --git a/app/services/order_available_shipping_methods.rb b/app/services/order_available_shipping_methods.rb index d70d15e331..95603f9a68 100644 --- a/app/services/order_available_shipping_methods.rb +++ b/app/services/order_available_shipping_methods.rb @@ -20,6 +20,9 @@ class OrderAvailableShippingMethods private def filter_by_category(methods) + return methods unless OpenFoodNetwork::FeatureToggle.enabled?(:match_shipping_categories, + distributor&.owner) + required_category_ids = order.products.pluck(:shipping_category_id).to_set return methods if required_category_ids.empty? diff --git a/spec/services/order_available_shipping_methods_spec.rb b/spec/services/order_available_shipping_methods_spec.rb index 33a4550fdf..315f2397c4 100644 --- a/spec/services/order_available_shipping_methods_spec.rb +++ b/spec/services/order_available_shipping_methods_spec.rb @@ -234,6 +234,8 @@ describe OrderAvailableShippingMethods do before { standard_shipping cooled_shipping + + Flipper.enable(:match_shipping_categories) } it "provides all shipping methods for an empty order" do