I am converting a Magento 1 site to Magento 2 and need to upgrade an Owebia Advanced Shipping configuration file. I'm ok with most of the file but need to help on what this line from the Magento 1 version should be replaced with in the Magento 2 version.
"fees": "{cart.weight} > 30010 ? 262.56 + (ceil(({cart.weight} - 30010) / 1000) * 2.4) : {table {cart.weight} in 2510:50.40, 3010:55.20, 3510:61.20}"
Solved! Go to Solution.
I got a prompt reply when I contacted Owebia. Solution is:
'price' => $request->package_weight > 30010 ? 262.56 + (ceil(($request->package_weight - 30010) / 1000) * 2.4) : array_reduce([ [2510, 50.40], [3010, 55.20], [3510, 61.20] ], function ($carry, $item) use ($request) { if (isset($carry)) return $carry; if (isset($item[0]) && ($request->package_weight <= $item[0] || $item[0] == '*')) { $carry = $item[1]; } return $carry; }),
I got a prompt reply when I contacted Owebia. Solution is:
'price' => $request->package_weight > 30010 ? 262.56 + (ceil(($request->package_weight - 30010) / 1000) * 2.4) : array_reduce([ [2510, 50.40], [3010, 55.20], [3510, 61.20] ], function ($carry, $item) use ($request) { if (isset($carry)) return $carry; if (isset($item[0]) && ($request->package_weight <= $item[0] || $item[0] == '*')) { $carry = $item[1]; } return $carry; }),