I have been working to hide my woocommerce checkout shipping address if a user selects a shipping table rate option that has a Label of "Local Pickup". Most code snippets I have found trigger based on shipping_method. I tried a shipping-method like `table_rate:10:1', to no avail. Any ideas?
Also, I am not completely clear on how to designate the specific row in the table - I inspected the code and found the value above, but am unsure if its correct.
Shipping related plug-ins: Woocommerce Table Rate Shipping
Trying to use the following code as a base:
add_filter( 'woocommerce_checkout_fields', 'xa_remove_billing_checkout_fields' );
function xa_remove_billing_checkout_fields( $fields ) {
global $woocommerce;
// Set the desired shipping method to hide the checkout field(s).
$shipping_method = 'table_rate:10:1';
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
$chosen_shipping = $chosen_methods[0];
if ( $chosen_shipping == $shipping_method ) {
// Add/change field name to be hide
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
}
return $fields;
}
website: camp4coffee.com