From 95f29571067d2391893aa975ef785e3615ef0952 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Sun, 27 Jul 2025 15:50:38 -0400 Subject: [PATCH] Fix NoneType error in cart checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- make_post_sell/views/cart.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make_post_sell/views/cart.py b/make_post_sell/views/cart.py index d89a551..158f81d 100644 --- a/make_post_sell/views/cart.py +++ b/make_post_sell/views/cart.py @@ -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)