Custom field showing in wrong place
-
Hi, Custom field does not appear in shipping address in email. It shows above the address. I used this code to get it to show in the Billing Address, But I need it in the Shipping Address please. The field is called billing_suburb and shipping_suburb
add_filter( 'woocommerce_order_formatted_billing_address' , 'th56t_woo_custom_order_formatted_billing_address', 10, 2 ); function th56t_woo_custom_order_formatted_billing_address( $address, $WC_Order ) { $address['billing_suburb'] = get_post_meta( $WC_Order->get_id(), 'billing_suburb', true ); return $address; } add_filter( 'woocommerce_formatted_address_replacements', function( $replacements, $args ){ $replacements['{billing_suburb}'] = isset($args['billing_suburb']) ? $args['billing_suburb'] : ''; return $replacements; }, 10, 2 ); add_filter( 'woocommerce_localisation_address_formats' , 'woo_includes_address_formats', 10, 1); function woo_includes_address_formats($address_formats) { $address_formats['default'] = "{name}\n{company}\n{address_1}\n{address_2}\n{city}\n{state}\n{billing_suburb}\n{postcode}\n{country}"; // default address format // Add your country address format here return $address_formats; }
The page I need help with: [log in to see the link]
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Custom field showing in wrong place’ is closed to new replies.