Re: Checkout > Order Status page > Additional Scripts help

Solved

Checkout > Order Status page > Additional Scripts help

dalestreet
Excursionist
12 1 3

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
Excursionist
12 1 3

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 8 (8)

gr_trading
Shopify Partner
1935 146 202

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. | Shopify Free codes
To support Buy Me a Coffee
dalestreet
Excursionist
12 1 3

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
1935 146 202

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. | Shopify Free codes
To support Buy Me a Coffee
dalestreet
Excursionist
12 1 3

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
1935 146 202

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. | Shopify Free codes
To support Buy Me a Coffee
dalestreet
Excursionist
12 1 3

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>

ban2bi
Visitor
1 0 0

Hi, i hope you are doing well
i need you help on some problem I'm facing on my shopify store.
when i open the order status page nothing appears there, so i cant customize anything 

Screenshot (10).png


can you help ?

gr_trading
Shopify Partner
1935 146 202

@ban2bi ,

 

plz refer my answer for same topic.

 

https://community.shopify.com/c/shopify-design/text-as-active-link-or-image-on-thank-you-page-after-...

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | Shopify Free codes
To support Buy Me a Coffee