I have add to cart buttons like this:
<a href="{entry_id_path='weekend-courses/add-to-cart'}" >Book now</a>
'weekend-courses/add-to-cart' contains only this:
{if logged_out}
{redirect='account/login/return/weekend-courses/'}
{/if}
{if logged_in}
{exp:cartthrob:add_to_cart entry_id="{segment_3}" quantity="1" return="weekend-courses/checkout/{segment_3}"}
{/if}
Clicking the book now link adds an item to the cart and goes to weekend-courses/checkout/{segment_3} when I am logged-in AND when I am logged-out.
Changing to this
{if logged_out}
{redirect='account/login/return/weekend-courses/'}
{/if}
{if logged_in}
<p>Logged in</p>
{/if}
Works as expected.
Any ideas why this isn't working as expected?