Solved

add estimate delivery date in debut theme

Calisto
New Member
8 0 0

hi

 

I am using debut theme. I added the following code in the product-template.liquid.

 

<p> <img src="https://cdn-icons-png.flaticon.com/512/1670/1670915.png" style="height:25px;float:left;margin-right:10px;padding-bottom: 4px;"/>
Commandez maintenant pour une livraison entre <strong><span id="fromDate"></span> et <span id="toDate"></span></strong></p>
{{ '//cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js' | script_tag }}
<script>
var fromDate = Date.today().addDays("3");
if (fromDate.is().saturday() || fromDate.is().sunday()) {
fromDate = fromDate.next().monday();
}
var toDate = Date.today().addDays(5);
if (toDate.is().saturday() || toDate.is().sunday()) {
toDate = toDate.next().monday();
}
document.getElementById('fromDate').innerHTML = fromDate.toString('dddd MMMM dS');
document.getElementById('toDate').innerHTML = toDate.toString('dddd MMMM dS');
</script>

 

It shows 

Commandez maintenant pour une livraison entre Tuesday April 23rd et Monday April 8th. 

 

But I want the result as

Commandez maintenant pour une livraison entre dddd/mm/yyyy et dddd/mm/yyyy. 

 

What should i do? Tks

Accepted Solution (1)

Raj-webdesigner
Shopify Partner
236 52 53

This is an accepted solution.

Try This code 

<p>
    <img src="https://cdn-icons-png.flaticon.com/512/1670/1670915.png" style="height:25px;float:left;margin-right:10px;padding-bottom: 4px;"/>
    Commandez maintenant pour une livraison entre 
    <strong><span id="fromDate"></span> et <span id="toDate"></span></strong>
</p>

{{ '//cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js' | script_tag }}
<script>
    var fromDate = Date.today().addDays(3);
    if (fromDate.is().saturday() || fromDate.is().sunday()) {
        fromDate = fromDate.next().monday();
    }
    var toDate = Date.today().addDays(5);
    if (toDate.is().saturday() || toDate.is().sunday()) {
        toDate = toDate.next().monday();
    }
    document.getElementById('fromDate').innerHTML = fromDate.toString('dddd/dd/MM/yyyy');
    document.getElementById('toDate').innerHTML = toDate.toString('dddd/dd/MM/yyyy');
</script>
If you require further help to optimize your store, please don’t hesitate to reach out.

This contribution will always benefit you and you will get my full help easily and you can contact me easily.
Your Willpower Contribution Link :-

Contribution



Contect On My Mail :-raj.s.webdevloper@gmail.com

View solution in original post

Replies 2 (2)

Raj-webdesigner
Shopify Partner
236 52 53

This is an accepted solution.

Try This code 

<p>
    <img src="https://cdn-icons-png.flaticon.com/512/1670/1670915.png" style="height:25px;float:left;margin-right:10px;padding-bottom: 4px;"/>
    Commandez maintenant pour une livraison entre 
    <strong><span id="fromDate"></span> et <span id="toDate"></span></strong>
</p>

{{ '//cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js' | script_tag }}
<script>
    var fromDate = Date.today().addDays(3);
    if (fromDate.is().saturday() || fromDate.is().sunday()) {
        fromDate = fromDate.next().monday();
    }
    var toDate = Date.today().addDays(5);
    if (toDate.is().saturday() || toDate.is().sunday()) {
        toDate = toDate.next().monday();
    }
    document.getElementById('fromDate').innerHTML = fromDate.toString('dddd/dd/MM/yyyy');
    document.getElementById('toDate').innerHTML = toDate.toString('dddd/dd/MM/yyyy');
</script>
If you require further help to optimize your store, please don’t hesitate to reach out.

This contribution will always benefit you and you will get my full help easily and you can contact me easily.
Your Willpower Contribution Link :-

Contribution



Contect On My Mail :-raj.s.webdevloper@gmail.com

Dan-From-Ryviu
Shopify Partner
7525 1450 1449

Hi @Calisto 

You can do that by update code to this 

<p>
    <img src="https://cdn-icons-png.flaticon.com/512/1670/1670915.png" style="height:25px;float:left;margin-right:10px;padding-bottom: 4px;"/>
    Commandez maintenant pour une livraison entre 
    <strong><span id="fromDate"></span> et <span id="toDate"></span></strong>
</p>
{{ '//cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js' | script_tag }}
<script>
    var fromDate = Date.today().addDays("3");
    if (fromDate.is().saturday() || fromDate.is().sunday()) {
        fromDate = fromDate.next().monday();
    }
    var toDate = Date.today().addDays(5);
    if (toDate.is().saturday() || toDate.is().sunday()) {
        toDate = toDate.next().monday();
    }
    document.getElementById('fromDate').innerHTML = fromDate.toString('dddd/MM/yyyy');
    document.getElementById('toDate').innerHTML = toDate.toString('dddd/MM/yyyy');
</script>

- Helpful? Like or Accept solution!
- Ryviu - Product Reviews app, collect product reviews, import reviews from AliExpress, Amazon, Etsy, Shopee and Walmart and CSV.
- Lookfy app: Easy and fast to create Photo Gallery, Lookbook, Shop The Look
- Enjoy 1 month of Shopify for $1. Sign up now