From 131772f7b2f3b370dc47aedcedc3c20868e40222 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Fri, 3 Mar 2023 15:07:10 +0100 Subject: [PATCH] Variant can be "not available": next and don't update its estimate price --- app/controllers/admin/order_cycles_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/admin/order_cycles_controller.rb b/app/controllers/admin/order_cycles_controller.rb index 17c394efaa..1158ec9259 100644 --- a/app/controllers/admin/order_cycles_controller.rb +++ b/app/controllers/admin/order_cycles_controller.rb @@ -104,6 +104,9 @@ module Admin subscription.subscription_line_items.nil_price_estimate.each do |line_item| variant = OrderManagement::Subscriptions:: VariantsList.eligible_variants(shop).find_by(id: line_item.variant_id) + # If the variant is not available in the shop, the price estimate will be nil + next if variant.nil? + price = variant.price + fee_calculator.indexed_fees_for(variant) line_item.update_column(:price_estimate, price) end