I’m adding a function to WordPress to be run when an order has been placed on WooCommerce.
The API call is to add a delivery to the DeTrack System (http://www.detrack.com/api-documentation/add-deliveries/) via their API. This is in the form of a HTTP Post Request.
[
{
"date":"2014-02-11",
"do":"DO140211001",
"address":"63 Ubi Avenue 1 Singapore 408937",
"delivery_time":"09:00 AM - 12:00 PM",
"deliver_to":"John Tan",
"phone":"+6591234567",
"notify_email":"john.tan@example.com",
"notify_url":"http://www.example.com/notify.php",
"assign_to":"GT1234H",
"instructions":"Call customer upon arrival.",
"zone":"East",
"items":[
{
"sku":"T0201",
"desc":"Test Item #01",
"qty":1
},
{
"sku":"T0202",
"desc":"Test Item #02",
"qty":5
},
{
"sku":"T0203",
"desc":"Test Item #03",
"qty":10
}
]
},
{
"date":"2014-02-11",
"do":"DO140211002",
"address":"59 Ubi Avenue 1 Singapore 408938",
"delivery_time":"02:00 PM - 05:30 PM",
"deliver_to":"Jane Lim",
"phone":"+6581234567",
"notify_email":"jane.lim@example.com",
"notify_url":"http://www.example.com/notify.php",
"assign_to":"GT1234H",
"instructions":"Change pass at security counter before proceeding to level 3.",
"zone":"East",
"items":[
{
"sku":"T0211",
"desc":"Test Item #11",
"qty":1
},
{
"sku":"T0212",
"desc":"Test Item #12",
"qty":5
},
{
"sku":"T0213",
"desc":"Test Item #13",
"qty":10
}
]
}
]
This is the JSON on the API website but im not sure how to send this from the WooCommerce WC_Class website I have in the function.
Bit new to this so help is appreciated!