How to fix the “Fatal error: Call to undefined method WC_Order::get_shipping()” in WooCommerce/Wordpress is quite easy. Generally this error comes from using the wrong method of “get_shipping()”. The error is easily resolved by finding the location where this is showing and replacing it with something that does function as expected.
What causes the Undefined method WC_Order::get_shipping()?
When you are using WordPress there are generally several plugins that you will install after the fact to make your site run as expected. When you make the decision to install WooCommerce and create a store or membership based site you then likely have several more plugins installed. In many cases these plugins will not all play nice and when one is updated without them all being updated you run into this type of issue.
Example Undefined method WC_Order::get_shipping()
Fatal error: Call to undefined method WC_Order::get_shipping() in C:\wwwroot\shop\wp-content\plugins\custom_plugin_woo\plugin-woo.class.php on line 3260
The error you see above give us the following information. Most importantly we know that the error is occurring in the plugin “custom_plugin_woo” so we know where to start looking. Next we know that the file “plugin-woo.class.php” is where the error is being referenced and needs to be replaced. Last we know that the function causing the error is “get_shipping()” which tells us what to look for. Keep in mind that even though it tells us the error is on line 3260 that there may not even be that many lines in the file but a simple search should find the function being used.
How to fix the “Fatal error: Call to undefined method WC_Order::get_shipping()”
This is quite easy now that you know where to make the change. After you have located “get_shipping()” simply replace it with “get_formatted_shipping_address()”. If you have any issues or notice something I have missed please let me know via comments below.