mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://stackoverflow.com/questions/66562496/hide-shipping-address-on-woocommerce-orders-based-on-specific-shipping-methods/66565294
13 lines
552 B
Text
13 lines
552 B
Text
add_filter( 'woocommerce_order_needs_shipping_address', 'filter_order_needs_shipping_address', 10, );
|
|
function change_order_received_page_title_based_on_order_status( $needs_address, $hide, $order ) {
|
|
// Here set your shipping method instance Ids
|
|
$targeted_instances_ids = array( 1, 2 );
|
|
|
|
// Loop through "shipping" order items
|
|
foreach ( $order->get_items('shipping') as $item ) {
|
|
if( in_array( $item->get_instance_id(), $targeted_instances_ids ) ) {
|
|
return false;
|
|
}
|
|
}
|
|
return $needs_address;
|
|
}
|