Add basic out of stock modal

This commit is contained in:
Gaetan Craig-Riou
2025-01-27 20:52:41 +11:00
parent a7cde069c6
commit c73c2dd8a8
4 changed files with 17 additions and 32 deletions

View File

@@ -11,11 +11,12 @@ module OrderStockCheck
end
def handle_insufficient_stock
stock_service = Orders::CheckStockService.new(@order)
@any_out_of_stock = false
stock_service = Orders::CheckStockService.new(order: @order)
return if stock_service.sufficient_stock?
flash[:error] = Spree.t(:inventory_error_flash_for_insufficient_quantity)
redirect_to main_app.cart_path
@any_out_of_stock = true
end
def check_order_cycle_expiry