Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
In my email to customers who are able to pay for their order later, I have added the following code to show when they should pay:
{% assign due_date = payment_terms.next_payment.due_at | default: nil %}
{% if payment_terms.type == 'receipt' and due_date == nil %}
{% assign due_date = 'now' %}
{% endif %}
<h2>Payment of {{ order.total_outstanding | money }} is due {{ due_date | date: format: 'date' }}</h2>
However, If i choose Net7, Net15, Net30 or pick a custom date. This code shows no date at all?
I tried adding different variables that I though should work in emails like {{ payment_terms.next_payment.due_at}}, {{ payment_terms.current_payment.due_at }} or even {{ payment_terms.payment_terms_name }} just to see if the correct payment term is used (should return Net7 etc.), but they all return nothing?
How can i edit the above code so that it not only shows the correct date for upon receipt but also for net7, net15, net30 and custom dates?
Thank you!
Hi I know this is old, but I have been looking for the same thing. I found this:
The payment_terms filter must be used on the form object within a product form or cart form.
{{ form | payment_terms }}
https://shopify.dev/api/liquid/filters/payment_terms
If anyone is stumbling upon this post due to the Shopify non-functional help guide (located here: https://help.shopify.com/en/manual/orders/notifications/edit-template#payment-terms), here's a version of the code that works for me right now.
{% if payment_terms.type == 'receipt' and payment_terms.next_payment.due_at == nil %}
{% assign due_date = 'now' %}
{% else %}
{% assign due_date = payment_terms.next_payment.due_at | default: nil %}
{% endif %}
{% if payment_terms.type == 'fulfillment' and payment_terms.next_payment.due_at == nil %}
<h2>Payment of {{ order.total_outstanding | money }} is due on fulfillment</h2>
{% else %}
<h2>Payment of {{ order.total_outstanding | money }} is due on {{ due_date | date: '%d/%m/%Y' }}</h2>
{% endif %}
To edit the date format, just edit '%d/%m/%Y' to whichever format you would like. Here's Shopify's reference for dates: https://shopify.dev/docs/api/liquid/filters/date
Thank you so much for sharing this! YOU SAVED ME HOURS of hunting down these attributes to display payment terms on our invoices. Only change I made was to the date format, since I was using a template:
{{ due_date | date: ‘template.formatDate’ }}
Cheers!
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024