shipments;
/*echo "
";
print_r( $data );
echo "
";*/
foreach( $shipments as $shipment ) {
$ID = $shipment->id;
$service = $shipment->service;
$origin = $shipment->origin->address->addressLocality;
$destination = $shipment->destination->address->addressLocality;
$status = $shipment->status->description;
if( !$origin ) {
$origin = $shipment->origin->address->countryCode;
}
if( !$destination ) {
$destination = $shipment->destination->address->countryCode;
}
$product_name = $shipment->details->product->productName;
echo _e('Track ID', 'blackrock').": ".$ID; echo "
";
echo _e('Product name', 'blackrock').": ".$product_name; echo "
";
echo _e('Service', 'blackrock').": ".$service; echo "
";
echo _e('Origin', 'blackrock').": ".$origin; echo "
";
echo _e('Destination', 'blackrock').": ".$destination; echo "
";
echo _e('Status', 'blackrock').": ".$status; echo "
";
echo "
"; echo "
";
}
return '';
//echo 123;
}
if ( ! wp_next_scheduled( 'avcode_update_cron' ) ) {
//wp_schedule_event( time(), 'hourly', 'avcode_update' );
wp_schedule_event( time(), 'everyminute', 'avcode_update' );
}
add_action( 'avcode_update_cron', 'avcode_update_cron_func' );
function avcode_update_cron_func() {
wp_mail( 'matrosov-stanislav@mail.ru', 'Automatic email', 'Automatic scheduled email from WordPress to test cron');
}
add_filter( 'cron_schedules', 'wpshout_add_cron_interval' );
function wpshout_add_cron_interval( $schedules ) {
$schedules['everyminute'] = array(
'interval' => 60, // time in seconds
'display' => 'Every Minute'
);
return $schedules;
}