Skip to content

Commit

Permalink
If order page requested with a number and cart is not empty then do n…
Browse files Browse the repository at this point in the history
…ot redirect to cart
  • Loading branch information
peteeveleigh committed Sep 17, 2024
1 parent 92d7bd3 commit 6eac653
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/templates/_layouts/default.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
{% set cart = craft.commerce.carts.cart %}
{% endif %}

{% if craft.app.request.getSegment(1) != craft.fostercheckout.getPath('cart')
and cart.lineItems|length == 0 %}
{% if
(craft.app.request.getSegment(1) != craft.checkout.paths.cart and craft.app.request.getSegment(-1) != 'order' and cart.lineItems|length == 0)
or (craft.app.request.getSegment(-1) == 'order' and craft.app.request.getParam('number') == null)
%}
{% redirect craft.fostercheckout.getPath('cart') %}
{% endif %}

Expand Down

0 comments on commit 6eac653

Please sign in to comment.