I changed the product size but the shipping cost is not changed
WooCommerce caches calculated shipping rates for better performance.
If you are testing the plugin, then you may wish to enable shipping debug mode. This way all your changes are reflected immediately.
Do not forget to remove that option once you are done with testing.