The @cart instance variable was only being conditionally defined if current_order.add_item succeeded. This caused an error if #add_item happens to fail when calling POST /cart/items from the storefront, resulting in a 500 error. To prevent this error, the definition of this variable has been moved above the condition.
The
@cart
instance variable was only being conditionally defined ifcurrent_order.add_item
succeeded. This caused an error if#add_item
happens to fail when callingPOST /cart/items
from the storefront, resulting in a 500 error. To prevent this error, the definition of this variable has been moved above the condition.