Order Expiry Woocommerce
Thu Jul 06 2023 11:56:58 GMT+0000 (Coordinated Universal Time)
Saved by
@gshailesh27
jQuery(".woocommerce-orders-table tbody tr").each(function(){
var val = jQuery(this).children('.woocommerce-orders-table__cell-order-date').children('time').attr('datetime');
console.log(val);
let givenDate = val;
let formatedDate = givenDate.replace('T', ' ').substring(0, 19);
console.log(formatedDate);
var date = new Date(formatedDate);
var now = new Date();
var diffInMS = now - date;
var msInHour = Math.floor(diffInMS/1000/60);
if (msInHour < 120) {
console.log('within the hour');
} else {
jQuery(this).children('.woocommerce-orders-table__cell-order-actions').children('.wc-cancel-order').hide();
}
});
content_copyCOPY
Comments