How to fix login button redirecting to cart page instead of login page?

Topic summary

Issue: A login button placed on a product details page navigates to the cart instead of the intended login URL.

Context: Implemented in a Shopify theme (Liquid) within the price section. The code displays price, compare-at price, and savings, then iterates product.collections and:

  • If a collection title equals “On Request”, renders a link labeled “SUPPLY NOW” pointing to https://seller.work-tops.com/index.php?p=login.
  • Else branch contains an empty “unless customer” block. The loop breaks after the first collection.

Code specifics:

  • The link is written in Markdown format SUPPLY NOW.
  • No explicit login/customer check is executed outside the “On Request” condition due to the empty block.

Request: Help fixing the behavior so the button/link goes to the login page rather than redirecting to the cart.

Status: No solution or consensus provided yet; the thread remains open. The provided code snippet is central to understanding and troubleshooting the issue.

Summarized with AI on March 1. AI used: gpt-5.

i have set login button on product details page in price place when they click need to go to login but is going to cart page please help me to how to fix this

this is the code for that

## 
  {% if product.selected_or_first_available_variant.price > 0 %}{{ product.selected_or_first_available_variant.price | money }}{% else %}{{ 'products.product.free' | t }}{% endif %}{% if product.selected_or_first_available_variant.compare_at_price > product.selected_or_first_available_variant.price %} <del>{{ product.selected_or_first_available_variant.compare_at_price | money }}</del>{% endif %}
  {{ 'products.product.savings' | t }} {{ product.selected_or_first_available_variant.compare_at_price | minus: product.selected_or_first_available_variant.price | money_without_trailing_zeros }}
 
{% if product.collections %}
    {% for collection in product.collections %}
			{% if collection.title == 'On Request'%}
				[SUPPLY NOW](https://seller.work-tops.com/index.php?p=login)
				

                    

                

            {% else %}
                  {% unless customer %} 
                    
                  {% endunless %}
                   

          	{% endif %}
		{% break %}
	{% endfor %}
{% endif %}