universal shipping methode extension

https://fr.store.owebia.com/magento2-module-advanced-shipping.html

guide:

http://htmlpreview.github.io/?https://github.com/owebia/magento2-module-advanced-shipping-setting/blob/master/view/doc_en_US.html#addons
Using special functions
Defining a table
EXAMPLE
WITH FUNCTIONS ADD-ON
// If the package weight is lower or equal to 0.5, the price will be 5.30
// If the package weight is lower or equal to 1.0, the price will be 6.50
// In others cases, the price will be 7.50
addMethod(‘id_013’, [
‘title’ => “Shipping”,
‘price’ => array_reduce([ [0.7, 5.30], [1.0, 6.50], [‘*’, 7.50] ], function ($carry, $item) {
global $request;
if (isset($carry)) return $carry;
if (isset($item[0]) && ($request->package_weight <= $item[0] || $item[0] == ‘*’)) {
$carry = $item[1];
}
return $carry;
}),
]);
// You can exclude the upper limit value by adding an argument false
addMethod(‘id_014’, [
‘title’ => “Shipping”,
‘price’ => array_reduce([ [0.7, 5.30], [1.0, 6.50], [‘*’, 7.50] ], function ($carry, $item) {
global $request;
if (isset($carry)) return $carry;
if (isset($item[0]) && ($request->package_weight < $item[0] || $item[0] == ‘*’)) {
$carry = $item[1];
}
return $carry;
}),
]);