How do I update product shipping using PHP in WooCommerce?

Based on the code found here you could do calculations on the cart object with WC()->cart->get_cart by doing whatever math you need to do for each product, in your case the custom glass. Get the contents of the cart, calculate your dimensions, and then remove the shipping methods based on your results.

Just add a custom plugin or some lines in your functions.php e.g.

add_filter( 'woocommerce_available_shipping_methods', 'calc_glass_items_and_filter_shipping_methods', 10, 1 );

function calc_glass_items_and_filter_shipping_methods($available_methods){

  // get the items in cart
  $items = WC()->cart->get_cart;

//cycle through items using the product id's to get the dimensions you must have already set in the meta

foreach($items as $cart_key => $item){

  $procuct_id = $item->id;
  $length = get_post_meta($product_id, '_width', true;

  // and on and on ... math math math
  $item_dimensions[] = $your_cart_item_dimensions; // e.g. 'large' or 'small'

}
// Then do some work on the $item_dimensions array
//  math math math

$whatever_you_figure_out = $math_math_math;

if($whatever_you_figure_out == 'large'){
  $carrier="fedex"; // this is the one you'd like to remove
    }else{
  $carrier="usps"; // or remove this one
    }

$available_methods = wp_filter_object_list( $available_methods, array( 'method_id' => $carrier ), 'NOT' );

return $available_methods;

}

Its especially helpful to debug with xdebug locally, so you can see what the $available_methods array or object actually holds.

Hope that helps.

tech