Hi
Question regarding WooCommerce
1st question:
Im trying to add function with pickup locations, but i do not know how to get correctly the shipping method ID what has been chosen on billing page for IF eg: if ( $shipping_method == 'flat_rate' ), so how to define the shipping method that this would be TRUE?
2nd question:
I have this code below, could i make it auto refresh if user changes the shipping method?
Thanks in advance!
if ( $shipping_method == 'flat_rate' )
{
add_filter( 'woocommerce_checkout_fields' , 'custom_store_pickup_field');
function custom_store_pickup_field( $fields ) {
$fields['billing']['store_pickup'] = array(
'type' => 'select',
'options' => array(
'option_1' => 'Option 1 text',
'option_2' => 'Option 2 text',
'option_3' => 'Option 3 text'
),
'label' => __('Store Pick Up Location', 'woocommerce'),
'required' => false,
'class' => array('store-pickup form-row-wide'),
'clear' => true
);
return $fields;
}
}
elseif ( $shipping_method == 'flat_rate_2' )
{
add_filter( 'woocommerce_checkout_fields' , 'custom_store_pickup_field');
function custom_store_pickup_field( $fields ) {
$fields['billing']['store_pickup'] = array(
'type' => 'select',
'options' => array(
'option_4' => 'Option 4 text',
'option_5' => 'Option 5 text',
'option_6' => 'Option 6 text'
),
'label' => __('Store Pick Up Location', 'woocommerce'),
'required' => false,
'class' => array('store-pickup form-row-wide'),
'clear' => true
);
return $fields;
}
}