I am attempting to create a shipment to go along with an order, however the process fail upon creating the order, but returns no error, only crashes the program.
Here are a couple ways that I have tried:
$shipment = array(
'tracking_number' => $TrackingNumber,
'order_address_id' => $orderAddressId,
'items' => $itemArray
);
Bigcommerce::createResource('/orders/'.$order->id.'/shipments', $shipment);
This block fails without error upon createResource
$shipment = new Bigcommerce\Api\Resources\Shipments();
$shipment->tracking_number = $TrackingNumber;
$shipment->order_address_id = $orderAddressId;
$shipment->items = $itemArray;
$shipment->create();
This block fails without error on the first line.
Is my syntax off somewhere, or am I just missing something?
You cannot create subresources like that. You need to extend the Resource model. Look at this sample code from the Bigcommerce PHP lib -
https://github.com/bigcommerce/bigcommerce-api-php/blob/master/src/Bigcommerce/Api/Resources/OrderProduct.php
It defines orders/products. You need to do something similar for orders/shipments
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With