Display Product 2 when tagged with Product 1's handle

I am trying to get a replacement product to show up on a discontinued products page.

We currently have a system that allows us to attach related articles to product pages by tagging the article with the handle (article.handle) of the page. I am now trying to replicate this but with products.

Below is the code I have so far

{% for product in collection.all.products %}
	{% for tag in product.tags %}
		{% if tag == product.handle %}
			
				### Related Articles
			

		    
		    	

		        	

		        		
		            		### {{ product.title }}
                            

>{{ product.sku }}

		            	
		        	

		        

		    

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

Hi @JoshSpires ,

Please change the code as below:

{% for productRelated in collections.all.products %}
  {% for tag in product.tags %}
    {% if tag == productRelated.handle %}
      
        ### Related Articles
      

      
        

          

            
              ### {{ productRelated.title }}
              

>{{ productRelated.sku }}

            
          

        

      

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

Hope this helps

Please mark as a solution if you find my answer helpful. Good luck on your project!