Passing custom variable form product to cart page

Solved
Highlighted
New Member
2 0 0

So I have installed a script that shows a "completion date" on the product page

 

How do I go about passing that custom variable onto the cart page, so it is recorded with their order?

 

I am a real novice, so please don't confuse me , thinking I'm on your level LOL

 

Thanks in advance. 

 

 
</script>

    
            
                          <h4>Your estimated date for completion is </h4>
          <h4 id="new"></h4>


<script>
var d = new Date();
d.setDate(d.getDate() + 30);
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var date = d.getDate()+' '+months[d.getMonth()]+', '+d.getFullYear(); 
document.getElementById("new").innerHTML = date;
  
  

  
  
  
  
  
  
  
</script>
 
0 Likes
Highlighted
Shopify Partner
1024 212 256

This is an accepted solution.

Hello 

Add this under form tag

  <input id="estimated-date" type="hidden" name="properties[estimated date]">

And replace your script to this

<script>
var d = new Date();
d.setDate(d.getDate() + 30);
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var date = d.getDate()+' '+months[d.getMonth()]+', '+d.getFullYear(); 
document.getElementById("new").innerHTML = date;
document.getElementById("estimated-date").value = date;
</script>

Thanks

Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
1 Like
Highlighted
New Member
2 0 0

Thanks so much, that is working perfectly.

0 Likes
Highlighted
New Member
1 0 0

Hi the .innerHTML = "ABC" is not working on the Shopify pages

 

Any ideas ?

0 Likes