i have a custom attribute where products have different pickup times. i want to add this dates as a custom field to my wc orders, to notify my customers via cronjob that the order is ready to pickup.
with the code below i get the wrong date, can anyone tell me what is wrong here?
foreach ( $order->get_items() as $item_id => $item ) {
$product_id = $item->get_product_id();
$order_id = $order->get_id();
$new_product = new WC_Product( $product_id ); // create an object of WC_Product class
//$product_attribut = $new_product->get_attribute( 'pa_lieferfrequenz' ); // call get_attribute method
$product_attribut = '1week';
$date = date('d-m-Y', strtotime("+ ' . $product_attribut . '"));
add_post_meta( $order_id, 'lwb_pickup_time_email_notification', $date );
}