Solved

Checkout > Order Status page > Additional Scripts help

dalestreet
Tourist
7 1 0

Hello

 

Currently we have an additional script on the Order Status page, allowing customers to edit their order.

 

<script>window.cffOrderEditOrderStatusPageOrderId = '{{order.id}}'</script>

Some of our orders are tagged as subscription orders and need to be edited via our subscription app. I was hoping to amend the Additional Scripts to account for these orders. The code I have used is as follows, but does not detect the tag and does not present the subscription option. If anyone has a suggestion as to amendments, I would be very grateful. Thanks in advance.

<script>

{% if order.tags == "Subscription" %}

<p>This is a subscription order. Please <a href="https://eightouncecoffee.ca/account/login">login</a> to your account to manage your subscriptions.</p>

{% else %}

window.cffOrderEditOrderStatusPageOrderId = '{{order.id}}'

{% endif %}

</script>

Accepted Solution (1)
dalestreet
Tourist
7 1 0

This is an accepted solution.

Once again, thank you very much @gr_trading!

Your amendments to the script (plus a little extra), helped solve the issue. The final script that appears to be working as intended, is as follows.

<script>
{% if order.tags contains "Subscription" or order.tags contains "Subscription Recurring Order" or order.tags contains "Subscription First Order" %}
Shopify.Checkout.OrderStatus.addContentBox(
'<p><strong>THIS IS A SUBSCRIPTION ORDER</strong></p><br /><p>If you wish to edit or cancel your order, please <a href="https://eightouncecoffee.ca/account/login"><u>login</u></a> to your account to manage your subscriptions.</p>'
){% else %}
window.cffOrderEditOrderStatusPageOrderId = '{{order.id}}'
{% endif %}
</script>

View solution in original post

Replies 6 (6)

gr_trading
Shopify Partner
1591 138 171

Hi @dalestreet 

 

Order success page has very less access of attributes available in order object.

 

But before that are you sure APP has tagged the order before reaching to order success page.

 

If you just want to show msg and you know the subscription product you can write custom validation at success page to show the msg.

 

Try using below code to get the product id 

 

 

{% for line_item in checkout.line_items %}

 

{% endfor %}

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | YouTube Videos
To support Buy Me a Coffee
dalestreet
Tourist
7 1 0

Thanks @gr_trading 

 

Yes, the app tags the order prior to the user accessing the Order Status page.

Thank you for your suggestion. There are a significant and changing number of products that are available via subscription, so, unfortunately, identifying specific product IDs, and using them as the determining factor as to which message to display won't work in this instance.

 

Thanks for your insights and suggestions.

 

Kindest regards,

 

Dale

gr_trading
Shopify Partner
1591 138 171

Can you named the app want to check it's functionality and behaviour.

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | YouTube Videos
To support Buy Me a Coffee
dalestreet
Tourist
7 1 0

Wow @gr_trading thanks for continuing to help!

The app used to place the subscription orders is ReCharge and the app that allows for the editing of the standard, non-subscripton orders and for which the short script below currently works is called Orderify

<script>window.cffOrderEditOrderStatusPageOrderId = '{{order.id}}'</script>

 

Might the issue be poor Liquid syntax, on my behalf, when composing the expanded script below?

<script>

{% if order.tags == "Subscription" %}

<p>This is a subscription order. Please <a href="https://eightouncecoffee.ca/account/login">login</a> to your account to manage your subscriptions.</p>

{% else %}

window.cffOrderEditOrderStatusPageOrderId = '{{order.id}}'

{% endif %}

</script>

 

gr_trading
Shopify Partner
1591 138 171

Hi 

 

Please try using the below script

 

<script>
{% if order.tags contains "Subscription" %}
<p>This is a subscription order. Please <a href="https://eightouncecoffee.ca/account/login">login</a> to your account to manage your subscriptions.</p>
{% else %}
window.cffOrderEditOrderStatusPageOrderId = '{{order.id}}'
{% endif %}
</script>

 

 

Hope this will help...

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | YouTube Videos
To support Buy Me a Coffee
dalestreet
Tourist
7 1 0

This is an accepted solution.

Once again, thank you very much @gr_trading!

Your amendments to the script (plus a little extra), helped solve the issue. The final script that appears to be working as intended, is as follows.

<script>
{% if order.tags contains "Subscription" or order.tags contains "Subscription Recurring Order" or order.tags contains "Subscription First Order" %}
Shopify.Checkout.OrderStatus.addContentBox(
'<p><strong>THIS IS A SUBSCRIPTION ORDER</strong></p><br /><p>If you wish to edit or cancel your order, please <a href="https://eightouncecoffee.ca/account/login"><u>login</u></a> to your account to manage your subscriptions.</p>'
){% else %}
window.cffOrderEditOrderStatusPageOrderId = '{{order.id}}'
{% endif %}
</script>