Troubleshoot items not showing up in refund notification

Can anyone help me understand why the items aren’t showing up in this refund notification? I did just update some if + capture statements but I’m really not fluent in json or javascript. My goal is to specify each refund notification so that customers can only see the items that are being refunded, as opposed to only seeing the entire order.

I was hoping to use the if + capture statements listed in the solution at the end of this post, but I must be missing something:

https://community.shopify.com/c/shopify-design/quot-total-no-of-items-purchased-quot-instead-of-only-quot/td-p/406074

Here’s the code I’m using:


  
    
    
    
    
    
    
  
  
    <table>

      Your order has been refunded.
      <table>

        <table>

          <table>
<tr>
<th>

            {%- if shop.email_logo_url %}
              
                
              
            {%- else %}
              # 
                {{ shop.name }}
              
            {%- endif %}
          

</th>

<th>

</th>
</tr>
</table>
        </table>
        
        
              </table>
      <table>

        
        {% if refund_line_items.size == item_count %}
          {% capture email_title %}Your order has been refunded {% endcapture %}
		  {% capture rq_new_title %}refunded items{% endcapture %}
        {% elsif refund_line_items.size == 0 %}
          {% capture email_title %}You have received a refund {% endcapture %}
		  {% capture rq_new_title %}refund details{% endcapture %}
        {% else %}
          {% capture email_title %}Some items in your order have been refunded {% endcapture %}
		   {% capture rq_new_title %}refunded items{% endcapture %}
        {% endif %}
        {% capture email_body %}Total amount refunded: **{{ amount | money }}**{% endcapture %}

        
        <table>

        
          <table>

            <table>
<tr>
<th>

              

ORDER {{ order_name }}

            

</th>

<th>

</th>
</tr>
</table>
          </table>
        
          <table>

            <table>
<tr>
<th>

              ## {{ email_title }}
              {{ email_body }}

            

</th>

<th>

</th>
</tr>
</table>
          </table>
        
          <table>

            <table>

              #### Refunded items
              

              
                 {% for line in refund_line_items %} 
                {% endfor %}
              <table>

                
                  
                    <table>

                      <tr>
<td>

                      

</td>

                      <td>

                        Product
                      

</td>

                      <td>

                        Color/Size
                      

</td>

                      <td>

                        Qty
                      

</td>

                      <td>

                        Total
                      

</td>

                    </tr>
</table>
                  
                
                  
                    
                      <table>

                        <td>

                          {% if line.image %}
                            
                              
                            
                          {% endif %}
                        

</td>

              
                        <td>

                          {% if line.product.title %}
                            {% assign line_title = line.product.title %}
                          {% else %}
                            {% assign line_title = line.title %}
                          {% endif %}
              
                          {{ line_title }}
                          

                          {% for sku in line.variant.sku %}
                          

Style #: {{ sku }}

                          {% endfor %}
                        

</td>

              
                        <td>

                          {% unless line.variant.title == "Default Title" %}
                            {% for option in line.variant.options %}
                              
{{ option }}

                            {% endfor %}
                          {% endunless %}
                        

</td>

              
                        <td>

                          {{ line.quantity }}
                        

</td>

              
              
                        
                          {% if line.original_line_price != line.line_price %}
                            <del>{{ line.original_line_price | money }}</del>
                          {% endif %}
                          

{{ line.line_price | money }}

                        
                      </table>
                    
                  </table>
              <table>

                
                  <td>

</td>

                  
                    
                      {% if discounts %}
                        {% capture discount_title %}Discount {% if discounts.first.code %}({{ discounts.first.code }}){% endif %}{% endcapture %}
              
                        
              
                      {% endif %}
              
                      
              
                      {% for line in tax_lines %}
              
                        
              
                      {% endfor %}
              
                    <table>
<tr>

                          <td>

                            

                              {{ discount_title }}
                            

                          

</td>

                          <td>

                            {{ discounts_savings | money }}
                          

</td>

                        </tr>
<tr>

                        <td>

                          

                            Subtotal
                          

                        

</td>

                        <td>

                          {{ subtotal_price | money }}
                        

</td>

                      </tr>

              
                      <tr>

                        <td>

                          

                            Shipping
                          

                        

</td>

                        <td>

                          {{ shipping_price | money }}
                        

</td>

                      </tr>
<tr>

                          <td>

                            

                              {{ line.title }}
                            

                          

</td>

                          <td>

                            {{ line.price | money }}
                          

</td>

                        </tr>
</table>
              
                    <table>

                      
                      <tr>

                        <td>

Total

</td>

                        <td>

{{ total_price | money }}

</td>

                      </tr>

              
                    </table>
              
                    {% assign transaction_size = 0 %}
                    {% for transaction in transactions %}
                      {% unless transaction.kind == "capture" or transaction.kind == "void" %}
                        {% assign transaction_size = transaction_size | plus: 1 %}
                      {% endunless %}
                    {% endfor %}
              
                    {% if transaction_size > 1 %}
                      
              
                        {% for transaction in transactions %}
                          {% if transaction.status == "success" and transaction.kind == "authorization" or transaction.kind == "sale" %}
                            {% if transaction.payment_details.credit_card_company %}
                              {% capture transaction_name %}{{ transaction.payment_details.credit_card_company }} (ending in {{ transaction.payment_details.credit_card_last_four_digits }}){% endcapture %}
                            {% else %}
                              {% capture transaction_name %}{{ transaction.gateway | replace: "_", " " | capitalize }}{% endcapture %}
                            {% endif %}
              
              
                            
              
                          {% endif %}
                          {% if transaction.kind == 'refund' %}
                            {% if transaction.payment_details.credit_card_company %}
                              {% assign refund_method_title = transaction.payment_details.credit_card_company %}
                            {% else %}
                              {% assign refund_method_title = transaction.gateway %}
                            {% endif %}
              
                            
                            
              
                          {% endif %}
                        {% endfor %}
                      <table>

                        <tr>
<td colspan="2">

</td>
</tr>

                        <tr>
<td colspan="2">

</td>
</tr>
<tr>

                              <td>

                                

                                  {{transaction_name}}
                                

                              

</td>

                              <td>

                                {{ transaction.amount | money }}
                              

</td>

                            </tr>

                              
                                

                                  Refund
                                    

                                    <small>{{ refund_method_title | capitalize }}</small>
                                

                              
                              
                                - {{ transaction.amount | money }}
                              
                            </table>
                    {% endif %}
                  
                
              </table>    </table>
          </table>
        
          <table>

            <table>

              <table>

                <table>

                  <tr>

                    <td>

                    	

							

We sincerely apologize for any inconvenience and would like to extend a discount on your next order with us of 15% off. 
								Enter code **VaultMay15** for 15% off any merchandise excluding antique and archive items.

							

							

                    		#### **For Return Policies and Other Frequently Asked Questions, click** [here](https://www.alexisbittar.com/pages/frequently-asked-questions#returns-exchange/?utm_source=transactionalemail&utm_medium=email&utm_campaign=OrderRefund)

                    	

                    

</td>

                  </tr>

                  <tr>

                    <td>

                    	

                    		#### Contact Us
                    		

Customer Service
888-807-7780
Email
Service@alexisbittar.com

                    	

                    

</td>

                  </tr>

                </table>
              </table>    
</table>
          </table>
        
        </table>
      </table>
      <table>

        <table>

          <table>

            <tr>

              <td>

© 2020 AnonX Inc.

</td>

            </tr>

            <tr>

              <td>

[Terms Of Use](https://www.alexisbittar.com/pages/terms-conditions/?utm_source=transactionalemail&utm_medium=email&utm_campaign=OrderRefund)[Privacy Policy](https://www.alexisbittar.com/pages/privacy-policy/?utm_source=transactionalemail&utm_medium=email&utm_campaign=OrderRefund)

</td>

            </tr>

<tr>
<td>

</td>
</tr>
<tr>

          </tr>
</table>
        </table>      </table>
    </table>