Compare commits

..

1 Commits

Author SHA1 Message Date
giles
7b55d78214 Fix cross-origin cart +/- buttons by supporting cart_quantity_url in template
The cart_item macro now checks for cart_quantity_url (defined only in the cart app)
and uses it for same-origin quantity updates, falling back to market_product_url.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:31:06 +00:00

View File

@@ -188,10 +188,11 @@
<div class="mt-3 flex flex-col sm:flex-row sm:items-center justify-between gap-2 sm:gap-4"> <div class="mt-3 flex flex-col sm:flex-row sm:items-center justify-between gap-2 sm:gap-4">
<div class="flex items-center gap-2 text-xs sm:text-sm text-stone-700"> <div class="flex items-center gap-2 text-xs sm:text-sm text-stone-700">
<span class="text-[0.65rem] sm:text-xs uppercase tracking-wide text-stone-500">Quantity</span> <span class="text-[0.65rem] sm:text-xs uppercase tracking-wide text-stone-500">Quantity</span>
{% set qty_url = cart_quantity_url(item.product_id) if cart_quantity_url is defined else market_product_url(p.slug, 'cart', item.market_place) %}
<form <form
action="{{ market_product_url(p.slug, 'cart', item.market_place) }}" action="{{ qty_url }}"
method="post" method="post"
hx-post="{{ market_product_url(p.slug, 'cart', item.market_place) }}" hx-post="{{ qty_url }}"
hx-target="#cart-mini" hx-target="#cart-mini"
hx-swap="outerHTML" hx-swap="outerHTML"
> >
@@ -212,9 +213,9 @@
{{ item.quantity }} {{ item.quantity }}
</span> </span>
<form <form
action="{{ market_product_url(p.slug, 'cart', item.market_place) }}" action="{{ qty_url }}"
method="post" method="post"
hx-post="{{ market_product_url(p.slug, 'cart', item.market_place) }}" hx-post="{{ qty_url }}"
hx-target="#cart-mini" hx-target="#cart-mini"
hx-swap="outerHTML" hx-swap="outerHTML"
> >