$order_shipping_methods = $order->get_shipping_methods();
$shipping = reset($order_shipping_methods);
How to replace reset() icorrectly in this case. Since it is removed in 8.1. Please help
$order_shipping_methods = $order->get_shipping_methods();
$shipping = reset($order_shipping_methods);
How to replace reset() icorrectly in this case. Since it is removed in 8.1. Please help
From the documentation
Yes i read the documentation first before asking im dumbstroke at the moment. Tried everything but could not manage to get out of it.
$order_shipping_methods = $order->get_shipping_methods();
$shipping = is_array($order_shipping_methods) ? (count($order_shipping_methods) > 0 ? array_values($order_shipping_methods)[0] : null) : null;
This is what i came up with but it would not work?
What’s the purpose of the code? Is it to get an array of shipping methods (i know that’s what it says, but that doesn’t mean anything I’ve found).
reset would in theory return the first item in the array.