If you haven't sorted this already, you need to use Javascript to generate the date - won't work with PHP. I believe the date is used by Google to send the review to the cusomer so it needn't be too specific, in this example I've just added 7 days to the current date:
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn"async defer></script><script>
window.renderOptIn =function(){
window.gapi.load('surveyoptin',function(){const deliveryDate =newDate();
deliveryDate.setDate(deliveryDate.getDate()+7);function formatDate(date){var d =newDate(date),
month =''+(d.getMonth()+1),
day =''+ d.getDate(),
year = d.getFullYear();if(month.length <2)
month ='0'+ month;if(day.length <2)
day ='0'+ day;return[year, month, day].join('-');}
window.gapi.surveyoptin.render({// REQUIRED FIELDS"merchant_id":12345678,"order_id":"{orderId}","email":"{customerEmailAddress}","delivery_country":"GB","estimated_delivery_date": formatDate(deliveryDate)// OPTIONAL FIELDS//"products": [{"gtin":"GTIN1"}, {"gtin":"GTIN2"}]});});}</script>
How to Google Customer Reviews Opt-In
in Commerce
Posted
Hello,
If you haven't sorted this already, you need to use Javascript to generate the date - won't work with PHP. I believe the date is used by Google to send the review to the cusomer so it needn't be too specific, in this example I've just added 7 days to the current date:
Hope it helps