Hi,
I’m trying to develop shipping plugin. I want to add a text field that user can write some data. Then that data should be available in order details.
How to do it properly?
I am able to display field adding it like that. But how to save it in database in order?
function onShippingDisplay(&$order,&$methods,&$usable_methods,&$messages) {
foreach ($methods as $method) {
if ($method->shipping_type !== 'newpluginshipping') {
continue;
}
$method->shipping_name = 'My Shipping';
$method->shipping_description = 'More info.';
$html = '<div class="my-shipping-field">';
$html .= '<label for="my-shipping-field">Write detalis</label>';
$html .= '<input type="text" name="my-shipping-field" id=" my-shipping-field" value="" />';
$html .= '</div>';
$method->custom_html = $html;
$usable_methods[] = $method;
}
}