I am using clear_cart to clear the cart when a completed order returns to the site from Paypal Express. The Shop page has a link to /checkout to go make a purchase using the Paypal express gateway. The checkout_form returns from Paypal to "checkout/order_status" and is supposed to display one of the following messages.

I am getting a "too many redirects" error (error 310) anytime I try to go to /checkout because the clear_cart tag is rendering and redirecting whether a transaction has been authorized or not. I can't even get to the checkout page usually to check my cart and be sent to Paypal. I have cleared the EE cache as well as Chrome cache multiple times with no success. Why is this tag acting when there is no order_status in segment_2 and also causing an infinite redirect?

Here is the full code I am using on the checkout page:

                {exp:cartthrob:cart_items_info limit="1"}
                    {if no_results}
                        <p>There is nothing in your cart yet</p>
                    <ul class="cart-table">
                        <li>Total Items: <span>{total_items}</span></li>
                        <li>Subtotal: <span>{cart_subtotal}</span></li>
                        <li>Shipping: <span>{exp:cartthrob:cart_shipping}</span></li>
                        <li>Tax Rate: <span>{cart_tax_rate}</span></li>
                        <li>Tax: <span>{cart_tax}</span></li>
                        <li><p class="lead"><strong>Total: <span>{cart_total}</span></strong></p></li>
{!-- Current items --}
                    {if no_results}
                        <p>You have nothing in your cart. <a class="blue" href="/shop">GO SHOP &raquo;</a></p>
                    {if total_items > 0}
                        {if first_row}
                        {exp:cartthrob:update_cart_form  return="checkout" class="cart_form" show_errors="yes" error_handling="inline"}
                        <ul class="cart-table">
                            <p class="error">{error}</p>
                            {if product_detail_image}
                                <img src="{product_detail_image:feed}"/>
                            <img src="{site_url}content/img/ride.png"/>
                            <li><p class="lead"><strong>{title}</strong> <span>Qty: <input type="text" name="quantity[{row_id}]" size="1" maxlength="2" value="{quantity}" /></span></p>
                                <p>{exp:cartthrob:item_options entry_id="{entry_id}" row_id="{row_id}"}
                                    {if dynamic}
                                                {if options_exist}
                                                            {if "{inventory}" > "0"}<option {selected} value="{option_value}">{option_name} {option_price}</option>{/if}
                                <span><input type="checkbox" name="delete[{row_id}]"> Delete this item</span></p>
                        {if last_row}
                            <select name="shipping_option">
                                    <option value="{rate_short_name}" {if selected}selected{/if}>{rate_title} - {rate_price}</option>
                                <input type="submit" value="Update Cart" />

{!-- CHECKOUT --}
                {exp:cartthrob:checkout_form return="checkout/order_status" gateway="paypal_express"
                    {if total_items > 0}
                        <input type="submit" value="Checkout with Paypal" />

Quick note: I also tried

{if segment_2 == "order_status"}
but this is probably irrelevant

1 Answer 1


This is because EE will execute tags before parsing certain conditionals. You should stick your clear_cart tag into it's own template and embed that template within your conditional. Embeds get executed at the very end, after conditionals are evaluated, so it will only execute if the condition is true.

  • This helped...what I had to do was change the redirect url in the clear_cart tag because it was going into an infinite loop. I changed the checkout_form redirect to checkout/clear_cart, added a conditional for that wrapping the clear_cart embed, then changed the clear_cart redirect to checkout/order_status.
    – Alexa L
    May 21, 2013 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.