From 8633470a651ddcfd4f246ccac968bb70073f84d6 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Wed, 13 May 2026 10:59:00 -0400 Subject: [PATCH] fix: hide checkout left column when there's nothing to put in it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The left column used to always render when stripe was enabled and the shop was stripe-ready, even when the buyer had no card on file — showing a duplicate "Add a credit card payment method" CTA next to the right-column "Pay with Credit Card — Add Card" button. Two identical CTAs in two columns read as a broken page. Left column now renders only when it has concrete content: - an Active Card to display, or - an Active Shipping Address for a physical product in the cart. Otherwise the page collapses to a centered single column (the CSS :has(.checkout-left) selector already handled this layout case). Existing assertion test_cart_checkout_for_shop now also asserts the left-column "no card configured" copy no longer appears. --- make_post_sell/templates/cart_checkout.j2 | 25 ++++++++++++----------- make_post_sell/tests/test_functional.py | 5 +++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/make_post_sell/templates/cart_checkout.j2 b/make_post_sell/templates/cart_checkout.j2 index 3744ed5..eebd02c 100644 --- a/make_post_sell/templates/cart_checkout.j2 +++ b/make_post_sell/templates/cart_checkout.j2 @@ -5,11 +5,18 @@
- {% if (stripe_enabled and request.shop and request.shop.is_stripe_ready) or request.user.active_address %} + {# Left column renders only when there's something concrete to show: + an Active Card to confirm, or an Active Shipping Address for a + physical product. The "no card yet" CTA used to live here, but + it's redundant now that the right column has a prominent + "Pay with Credit Card — Add Card" button alongside PayPal / + crypto. Two duplicate CTAs read as a broken page. #} + {% set has_card_section = stripe_enabled and request.shop and request.shop.is_stripe_ready and active_card %} + {% set has_shipping_section = request.user.active_address and cart.physical_products %} + {% if has_card_section or has_shipping_section %}
- {% if stripe_enabled and request.shop and request.shop.is_stripe_ready %} - {% if active_card %} + {% if has_card_section %}

Active Card

{{ stripe.display_card(active_card, actions=False) }} @@ -19,19 +26,13 @@ {% if request.shop and request.shop.is_ready_for_payment(request) %} Use a different card {% endif %} - {% else %} -

Payment

-

No active credit card payment method configured.

-

Add a credit card payment method

-
- {% endif %} {% endif %} - {% if request.user.active_address and cart.physical_products %} + {% if has_shipping_section %}

Active Shipping Address

{{- request.user.active_address.data -}}
- Use a different address - {% endif %} + Use a different address + {% endif %}
{% endif %} diff --git a/make_post_sell/tests/test_functional.py b/make_post_sell/tests/test_functional.py index d0802e4..36ee914 100644 --- a/make_post_sell/tests/test_functional.py +++ b/make_post_sell/tests/test_functional.py @@ -636,6 +636,11 @@ class AuthenticatedFunctionalTests(_AuthenticatedBase): # is buried in the left panel and easy to miss next to PayPal / # crypto CTAs. self.assertIn("Pay with Credit Card", checkout_body) + # The left column no longer renders its "no card configured" + # branch — the right-column CTA is the single place to add a + # card. Two duplicate CTAs read as a broken page. + self.assertNotIn("No active credit card payment method configured", checkout_body) + self.assertNotIn("Add a credit card payment method", checkout_body) def test_cart_checkout_logic_with_none_stripe_user_shop(self): """Test the specific logic that was causing AttributeError in cart checkout.