mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
(feat) update cart created_at after add a new item when cart is empty
This commit is contained in:
parent
9066148572
commit
1104316e62
@ -7,6 +7,8 @@ class Cart::AddItemService
|
||||
|
||||
raise Cart::InactiveProductError unless orderable.is_active
|
||||
|
||||
order.created_at = DateTime.current if order.order_items.length.zero?
|
||||
|
||||
item = order.order_items.find_by(orderable: orderable)
|
||||
quantity = orderable.quantity_min > quantity.to_i && item.nil? ? orderable.quantity_min : quantity.to_i
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user