How to add custom subject to subscription orders

Hey guys,

We want to have a custom subject line for each order containing a subscription. (except payment renewal, update, and cancellation orders)

Subject: "Save this email to update your next shipment date, address, or payment info"

How can we make this happen?

Here is our custom email template.
Comments
  • fc_adamfc_adam FoxyCart Team
    @Epotratz,

    Would I be correct in saying that you just want to have that for the initial subscription purchase? If so - adding this to the top of the template should achieve that:
    {% if is_new_subscription %}
    {% set custom_subject = 'Save this email to update your next shipment date, address, or payment info' %}
    {{ custom_subject|fc_output_data('email_subject') }}
    {% endif %}
    That will just update the subject if a brand new subscription is present in the cart.
  • EpotratzEpotratz Member
    @fc_adam,

    How would I modify the subject line for subsequent subscription orders? (recurring orders)

    FYI, I should mention we are using a modified email template from around Oct 2016. (I know you guys have updated some things since then)

  • fc_adamfc_adam FoxyCart Team
    @Epotratz,

    Subscription renewals (and I'm assuming not modifications or cancels) can be handled like this:
    {% if has_subscriptions and not is_new_subscription and not is_subscription_modification and not is_subscription_cancel %}
    {% set custom_subject = 'Custom email subject for renewals' %}
    {{ custom_subject|fc_output_data('email_subject') }}
    {% endif %}
  • EpotratzEpotratz Member
    @fc_adam,

    Thanks for walking me through this. Just to confirm before I cause a conflict or a trainwreck...

    These are the custom email_subjects already in our email...

    {% if days_since_first_failed_transaction == 5 %}
    {% set custom_subject = 'Please update your payment info for Palm Fruit' %}
    {{ custom_subject|fc_output_data('email_subject') }}


    {% elseif days_since_first_failed_transaction == 25 %}
    {% set custom_subject = 'Last chance to reactivate your Palm Fruit subscription' %}
    {{ custom_subject|fc_output_data('email_subject') }}


    {% if not is_subscription_dunning_reminder %}
    {% if is_subscription_modification %}
    {% set email_subject = "Your subscription has been updated" %}
    {{ email_subject|fc_output_data('email_subject') }}
    {% elseif is_subscription_cancel %}
    {% set email_subject = "Your subscription has been cancelled" %}
    {{ email_subject|fc_output_data('email_subject') }}
    {% endif %}
    {% endif %}


    Would it be OK to add your suggested code (without the {% endif %}?) at the bottom before these final {% endif %} {% endif %} sections?

    Thanks again.
  • fc_adamfc_adam FoxyCart Team
    edited June 13
    @Epotratz,

    Good question - you could combine the two like this:
    {% if not is_subscription_dunning_reminder %}
    {% if is_subscription_modification %}
    {% set email_subject = "Your subscription has been updated" %}
    {{ email_subject|fc_output_data('email_subject') }}
    {% elseif is_subscription_cancel %}
    {% set email_subject = "Your subscription has been cancelled" %}
    {{ email_subject|fc_output_data('email_subject') }}
    {% elseif has_subscriptions and not is_new_subscription %}
    {% set custom_subject = 'Custom email subject for renewals' %}
    {{ custom_subject|fc_output_data('email_subject') }}
    {% endif %}
    {% endif %}
  • EpotratzEpotratz Member
    @fc_adam,

    Excellent. Thanks for that.

    Also, if we're looking to insert some custom text into the top of the email, would it look something like this...?

    {% elseif is_new_subscription %}
    {% set sub = subscriptions|first %}
    {% if sub %}


    "custom message"

    {% elseif has_subscriptions and not is_new_subscription and not is_subscription_modification and not is_subscription_cancel %}
    {% set sub = subscriptions|first %}
    {% if sub %}


    "Second custom message"

    {% endif %}


  • fc_adamfc_adam FoxyCart Team
    @Epotratz,

    Assuming it's being added into an existing if conditional statement, that should be fine.
Sign In or Register to comment.