'PHP Warning: Trying to access array offset on value of type null in

  if($context == "checkoutProgress") {

            $params["shipping"] = "";
            $shipping_id = WC()->session->get( 'chosen_shipping_methods' )[0];
            $shipping_id = explode(":",$shipping_id)[0];
            if(isset(WC()->shipping->get_shipping_methods()[$shipping_id])) {
                $params["shipping"] = WC()->shipping->get_shipping_methods()[$shipping_id]->method_title;
            }
php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source