Skip to content
Advertisement

Always display shipping address in WooCommerce email notifications

WooCommerce used to show shipping address no matter which shipping method was selected during checkout, if you had to hide the shipping address from emails you had to do a custom job like in “https://stackoverflow.com/questions/38936283/hide-shipping-address-on-local-pickup-in-woocommerce-email-notifications/38937106#38937106” answer thread.

After new updates, WooCommerce hides the shipping address from the order emails if local pickup is selected during checkout. I want to show the shipping address on order emails even if local pickup is chosen, if no shipping address is provided, it should default to billing address (this is what happens if any other shipping method is selected to checkout). No idea where to start on this.


Edit #1:

Discussed with Woocommerce support, the change isn’t documented but they were able to guide me where this is coming from. According to them I should be able to use woocommerce_order_needs_shipping_address filter hook and it’ll start showing shipping address on order emails even when local pickup is used to checkout.

Any help would be appreciated.

Advertisement

Answer

This can be done using one simple line of code:

add_filter( 'woocommerce_order_needs_shipping_address', '__return_true' );

Code goes in function.php file of your active child theme (or active theme). Tested and works.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement