Estimatimated Delivery Date on product page

Solved

Estimatimated Delivery Date on product page

keyurdodiya
Tourist
18 0 2

Below code give Estimated delivery dates in numbers (9/8/2022). I want to show in this formate: Sep 8, 2022
What changes should I do in this code?

<tr>
<td style="width: 509px;">
<div style="text-align: center;"><span style="color: #8d0505;"> Order today and you'll receive your package on:<strong>
  
<script>// <![CDATA[
var currentTime = new Date();
currentTime.setDate(currentTime.getDate() + 14); 
  
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
document.write(month + "/" + day + "/" + year);
// ]]></script>
</strong>* </span>
</div>
</td>
</tr>
Accepted Solution (1)

PageFly-Richard
Shopify Partner
4584 1051 1711

This is an accepted solution.

Hi @keyurdodiya ,

I’m Richard Nguyen - CRO Expert at PageFly- Free Landing Page Builder.  I hope that my recommendations based on 6 years of providing solutions for more than 100.000 merchants can be beneficial to you in improving your store performance.

About your question, you can try to apply this code to try!

<tr>
<td style="width: 509px;">
<div style="text-align: center;"><span style="color: #8d0505;"> Order today and you'll receive your package on:<strong>
  
<script>// <![CDATA[
 Date.prototype.monthNames = [
    "January", "February", "March",
    "April", "May", "June",
    "July", "Aug", "Sep",
    "October", "November", "December"
];
Date.prototype.getMonthName = function() {
    return this.monthNames[this.getMonth() + 1];
};
Date.prototype.getShortMonthName = function () {
    return this.getMonthName().substr(0, 3);
};
// usage:
var d = new Date();
var currentTime = new Date();
currentTime.setDate(currentTime.getDate() + 14); 
var day = currentTime.getDate();
var year = currentTime.getFullYear();
document.write(d.getMonthName() + ' '  + day + ", " + year);
// ]]>
  
  </script>
</strong>* </span>
</div>
</td>
</tr>

Hope this can help you!
If you are looking for some tips to boosts your conversion rate, you can take a look at this article.

Please let me know if it works by giving it a Like or marking it as a solution!


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available) 


All features are available from Free plan. Live Chat Support is available 24/7.

View solution in original post

Replies 2 (2)

PageFly-Richard
Shopify Partner
4584 1051 1711

This is an accepted solution.

Hi @keyurdodiya ,

I’m Richard Nguyen - CRO Expert at PageFly- Free Landing Page Builder.  I hope that my recommendations based on 6 years of providing solutions for more than 100.000 merchants can be beneficial to you in improving your store performance.

About your question, you can try to apply this code to try!

<tr>
<td style="width: 509px;">
<div style="text-align: center;"><span style="color: #8d0505;"> Order today and you'll receive your package on:<strong>
  
<script>// <![CDATA[
 Date.prototype.monthNames = [
    "January", "February", "March",
    "April", "May", "June",
    "July", "Aug", "Sep",
    "October", "November", "December"
];
Date.prototype.getMonthName = function() {
    return this.monthNames[this.getMonth() + 1];
};
Date.prototype.getShortMonthName = function () {
    return this.getMonthName().substr(0, 3);
};
// usage:
var d = new Date();
var currentTime = new Date();
currentTime.setDate(currentTime.getDate() + 14); 
var day = currentTime.getDate();
var year = currentTime.getFullYear();
document.write(d.getMonthName() + ' '  + day + ", " + year);
// ]]>
  
  </script>
</strong>* </span>
</div>
</td>
</tr>

Hope this can help you!
If you are looking for some tips to boosts your conversion rate, you can take a look at this article.

Please let me know if it works by giving it a Like or marking it as a solution!


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available) 


All features are available from Free plan. Live Chat Support is available 24/7.

chris214
Excursionist
46 0 10

Hi @PageFly-Richard & @keyurdodiya thank you both for this shopify DIY delivery date on product page!!

 

Could you give a step by step explanation where to  put the above code?

 

I use the OOTS FLEX-Theme.

 

thank you both in advance for a hint

Chris