I would like to add this feature of hiding shipping method but one to all products if a variation has been chosen. There are thousands of products and there will be more in the future. I used this code:
$_product = $values['data'];
// if product variation id @ Cart, disable all but Local Pickup
if( $_product->variation_id == 26408 || $_product->variation_id == 26409 ) {
$wc_pickup_store = $rates['wc_pickup_store'];
$rates = array();
$rates['wc_pickup_store'] = $wc_pickup_store;
}
}
return $rates;
}
What I am trying to achieve is to replace the variation ID by the variation name instead so that this can be applied to all of products that has the same variation name.
Thanks for the help!