Untitled

mail@pastecode.io avatar
unknown
plain_text
18 days ago
525 B
4
Indexable
Never
add_filter('b2bking_apply_fee', function($apply, $fee_name, $fee_data){
    // Check if the chosen shipping method is 'local_pickup'
    $chosen_shipping_methods = WC()->session->get('chosen_shipping_methods');

    $local_chosen = false;
    foreach ($chosen_shipping_methods as $method){
    	if (strpos($method, 'local_pickup') !== false) {
    		$local_chosen = true;
    	}
    }
    
    if ($local_chosen) {
        if ($fee_name === 'fee test'){
        	$apply = false;
        }
    }

    return $apply;
}, 10, 3);
Leave a Comment