Thanks for the reply the code i was using is below.
I am wanting to hide the “ship to a different address” link and only show it to specific users, currently i was using customer roles. The code below completely removes the shipping section and i was having issues with the customers default shippiung address not coming through (only the billing address). Thanks
// Christopher's Hide Shipping to Link for users
add_action('init', 'unset_shipping_address' );
function unset_shipping_address() {
// user roles
$user_roles = array('bronze', 'silver', 'platinum', 'gold', 'cc004592', 'cc002901', 'cc004340', 'cc003477', 'cc003419', 'cc003263', 'cc003099', 'cc003091', 'cc003087', 'cc003046', 'cc002842', 'cc002594', 'cc002207', 'cc001767', 'cc001757', 'cc001188', 'cc002731', 'cc002962', 'cc002317', 'cc003459', 'cc002593', 'cc001396', 'cc002702', 'cc005239');
// Check user roles to hide “Ship to a different address”
foreach( $user_roles as $user_role ) {
if ( current_user_can( sanitize_title( $user_role ) ) ) {
add_filter( 'woocommerce_cart_needs_shipping_address', '__return_false');
break; // loop stop
}
}
}