Hi again,
I did some more digging and found that we at one point added support for adding dropp order ids on the shipping item meta field dropp_consignments
as either an array or a comma separated string.
Note that it’s important that you use the correct shipping method id. Regular dropp shipments have the id dropp_is
and shipments outside of capital area have the id dropp_is_oca
. You can find the id’s in the __construct
method of the shipping method class files located in the classes/shipping-method
directory.
I did encounter a bug when I tested that I fixed. That means that you might need to try this with the unreleased version of the plugin that you can find here: https://github.com/CoveAS/dropp-for-woocommerce/archive/refs/heads/master.zip
Here’s my example code:
<?php
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
$woocommerce = new Client(
'https://dropp.test',
'ck_******',
'cs_******',
[
'version' => 'wc/v3',
]
);
// Order data
$data = [
'payment_method' => 'bacs',
'payment_method_title' => 'Direct Bank Transfer',
'set_paid' => true,
'shipping_lines' => [
[
'method_id' => 'dropp_is',
'method_title' => 'Dropp',
'total' => '10.00',
'meta_data' => [
[
'key' => 'dropp_consignments',
'value' => '5f889916-2f0a-4baf-91af-cc16ebe74369',
],
],
],
],
// Add other order details as needed
];
$woocommerce->post('orders', $data);
Please consider giving the plugin a five star review if you found this helpful ??