Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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>
Solved! Go to the solution
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>
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 %}
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
Can you named the app want to check it's functionality and behaviour.
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>
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...
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>
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
can you help ?
@ban2bi ,
plz refer my answer for same topic.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024