mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Add feature toggle for filtering shipping methods
This commit is contained in:
@@ -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?
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user