function getDateAfter($days=10)
{
$formatted_date = new DateTime();
$date_timestamp = $formatted_date->getTimestamp();
// loop for X days
for ($i = 0; $i < ($days - 1); $i++) {
// get what day it is next day
$nextDay = date('w', strtotime('+1day', $date_timestamp));
// if it's Sunday or Saturday get $i-1
if ($nextDay == 0 || ($nextDay == 6)) {
$i--;
}
// modify timestamp, add 1 day
$date_timestamp = strtotime('+1day', $date_timestamp);
}
$formatted_date->setTimestamp($date_timestamp);
return $formatted_date->format(get_option('date_format'));
}
add_filter('wcpa_product_form_fields', function ($data, $product_id) {
// modify data from here
foreach ($data as $k => $v) {
if ($v->name == 'text-1595838503027') { // change this name with your field name
$v->value = getDateAfter(10);
}
}
return $data;
}, 10, 2);