Is there currently a way to upload a tracking number back to an order on BigCommerce in php? I can see on BigCommerce's API Doc for Shipments that there is a parameter to specific a tracking number for a PUT command. I also see that there is an update function within the Shipment.php file. However, I am unsure how to call the function that would allow me to do that, or if it is even possible upload a tracking number.
Below is a snippet from shipment.php
namespace Bigcommerce\Api\Resources;
use Bigcommerce\Api\Resource;
use Bigcommerce\Api\Client;
class Shipment extends Resource
{
...
public function create()
{
return Client::createResource('/orders/' . $this->order_id . '/shipments', $this->getCreateFields());
}
public function update()
{
return Client::createResource('/orders/' . $this->order_id . '/shipments' . $this->id, $this->getCreateFields());
}
}
Here is also the link to the API Doc for PUT.
https://developer.bigcommerce.com/api/stores/v2/orders/shipments#update-a-shipment
You can use the shipment object directly to create a new shipment, as long as you pass in required fields (as shown on the doc page).
You can also pass in the info directly as an array to the
createResource
function:Doing a
PUT
is similar. You can traverse to it from an order object:Or pull it back directly as an object and re-save it:
Or update it directly: