What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

New Order Notification code not displaying proper headers

New Order Notification code not displaying proper headers

FishyTech
New Member
4 0 0

Hey Team,

 

I could use a little help. I coded specific headers into our New Order notification so we can easily determine what's a membership order, what's a renewal, and what's a separate product order. Any product that is tagged with "Membership" (our subscriptions) will get either the "A new member has joined Fishadelphia!" header or "Renewal order placed..." header, based on if they have the "Mem-Active" tag on their profile. The Mem-Active tag gets populated after the order is submitted, so the first order should populate "A new member" since they don't have that tag on their profile yet. 

 

For orders that do not contain a membership, those orders get the header "Order placed on...".

 

For a while we had no issues, but now it's not working correctly. I set up a brand new testing profile (no tags or order history) and tried the following code:

 

First order

<table class="row content">
  <tr>
    <td class="content__cell {% if no_top_border == 'hide_border' %}no_top__border{% endif %}">
      <center>
        <table class="container">
          <tr>
            <td>
              <table class="row">
                <tr>
                  <td>
                    {% assign current_date = date | date: "%b %d" %}
                    {% assign current_time = date | date: "%l:%M %P" %}
                      {% if line.product.tags contains "Membership" %}
                        {% unless customer.tags contains "Mem-Active" %}
                    <table class="row">
                                    <tr>
                                      <td><strong>A new member has joined Fishadelphia!</strong></td></tr>
                        </table> 
                      {% else %}
                    <table class="row">
                                    <tr>
                                      <td><strong>Renewal order placed on {{ current_date }} at {{ current_time | strip }}.</strong></td></tr>
                        </table>
                      {% endunless %}
                    {% else %}
                    <table class="row">
                                    <tr>
                                      <td><strong>Order placed on {{ current_date }} at {{ current_time | strip }}.</strong></td></tr>
                        </table> 
                    {% endif %}

Code returned this new order notification (I want to display "A new member has joined Fishadelphia!" instead of "Order placed...")

Screenshot 2023-10-02 at 10.08.42 AM.png

 

 

Second Order:  I closed the "if" section and started an "unless" condition. In theory I would leave the "else" section of this blank instead of it showing "Error", but I wanted to see if something would populate either way.

 

                    <table class="row content">
  <tr>
    <td class="content__cell {% if no_top_border == 'hide_border' %}no_top__border{% endif %}">
      <center>
        <table class="container">
          <tr>
            <td>
              <table class="row">
                <tr>
                  <td>
                    {% assign current_date = date | date: "%b %d" %}
                    {% assign current_time = date | date: "%l:%M %P" %}
                      {% if line.product.tags contains "Membership" %}
                        {% unless customer.tags contains "Mem-Active" %}
                        <table class="row">
                                        <tr>
                                          <td><strong>A new member has joined Fishadelphia!</strong></td></tr>
                            </table> 
                          {% else %}
                        <table class="row">
                                        <tr>
                                          <td><strong>Renewal order placed on {{ current_date }} at {{ current_time | strip }}.</strong></td></tr>
                            </table>
                          {% endunless %}
                    {% endif %}
                    {% unless line.product.tags contains "Membership" %}
                        <table class="row">
                                    <tr>
                                      <td><strong>Order placed on {{ current_date }} at {{ current_time | strip }}.</strong></td></tr>
                        </table> 
                    {% else %}
                      Error
                    {% endunless %}

Code returned this new order notification (I also want "A new member has joined Fishadelphia!" displayed here instead of "Order placed...")

 

Screenshot 2023-10-02 at 10.27.45 AM.png

 

Can someone help me out? What am I missing? Again, both of these orders are with a brand new contact for the first order, and I removed any and all order tags (and cancelled/deleted the orders and subscriptions) before placing the second order.

 

I will also say, I had this issue before (with multiple email addresses), but when members started to sign up, the headers we working properly, so I figured it was just a weird glitch. I also tried placing the order from an incognito window just in case something was being cached.

 

Thanks, yall.

Replies 0 (0)