How to target a specific shipping method
-
Hello,
I want to hide a shipping method create with your plugin for a specific user only.
Where can I find the shipping method ID ?add_filter( 'woocommerce_package_rates', 'hide_shipping_for_x', 10, 2 ); function hide_shipping_for_x( $rates, $package ) { // client email to be excluded $excluded_email = "[email protected]"; // Shipping rate to be excluded $shipping_id = 'flexible_shipping_18_shipping'; // I need to find this value !? // Get current user's email $user = wp_get_current_user(); if ( empty( $user ) ) return false; if( in_array( $excluded_email, (array) $user->email ) && isset( $rates[ $shipping_id ] ) ) unset( $rates[ $shipping_id ] ); return $rates; }
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘How to target a specific shipping method’ is closed to new replies.