Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: add estimate delivery date in debut theme

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
349 87 82

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>

Are you looking for Shopify Developer then your search is over I will help you


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

:-

❤️Tip❤️

Contect On My Mail :-Mail@gmail.com


View solution in original post

Replies 2 (2)

Raj-webdesigner
Shopify Partner
349 87 82

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>

Are you looking for Shopify Developer then your search is over I will help you


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

:-

❤️Tip❤️

Contect On My Mail :-Mail@gmail.com


Dan-From-Ryviu
Shopify Partner
10253 2036 2106

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 and Accept solution! Or Support me: Buy Coffees
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.