Fix NoneType error in cart checkout

- Add null check for stripe_user_shop before accessing active_card property
- Prevents AttributeError: 'NoneType' object has no attribute 'active_card'
- Handle case where stripe_user_shop is None in cart checkout flow

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Russell Ballestrini 2025-07-27 15:50:38 -04:00
parent b67521936e
commit 95f2957106

View file

@ -455,7 +455,7 @@ def cart_checkout(request):
request.session.flash(msg)
return HTTPFound("/billing")
if stripe_user_shop.active_card is None:
if stripe_user_shop and stripe_user_shop.active_card is None:
msg = ("Please make a payment method active.", "info")
request.session.flash(msg)
return HTTPFound("/billing")
@ -465,7 +465,7 @@ def cart_checkout(request):
return {
"cart": cart,
"products": cart.products,
"active_card": stripe_user_shop.active_card,
"active_card": stripe_user_shop.active_card if stripe_user_shop else None,
}
request.session.flash(msg)