would like to add extra field on woocommerce checkout page - where to apply if condition if the selected country is equal to A - the checkout field should appear on checkout page
/**
* Add custom field to the checkout page
*/
add_action('woocommerce_after_order_notes', 'custom_checkout_field');
function custom_checkout_field($checkout)
{
echo '<div id="custom_checkout_field"><h2>' . __('Requried For Outside UAE') . '</h2>';
woocommerce_form_field('custom_field_name', array(
'type' => 'text',
'class' => array(
'my-field-class form-row-wide'
) ,
'label' => __('House No,Villa No,Building Name') ,
'placeholder' => __('') ,
'label' => __('Street Name') ,
'placeholder' => __('Street Name') ,
'label' => __('Landmark') ,
'placeholder' => __('Enter Nearest Landmark') ,
) ,
$checkout->get_value('custom_field_name'));
echo '</div>';
}
Aucun commentaire:
Enregistrer un commentaire