diff --git a/app/models/spree/product_decorator.rb b/app/models/spree/product_decorator.rb index a23f5501dc..33367ef319 100644 --- a/app/models/spree/product_decorator.rb +++ b/app/models/spree/product_decorator.rb @@ -189,7 +189,7 @@ Spree::Product.class_eval do OpenFoodNetwork::ProductsCache.product_deleted(self) do touch_distributors - ExchangeVariant.where('exchange_variants.variant_id IN (?)', variants_including_master.with_deleted).destroy_all + ExchangeVariant.where('exchange_variants.variant_id IN (?)', variants_including_master.with_deleted.select(:id)).destroy_all destroy_without_delete_from_order_cycles end