Conditionals on WooCommerce Form Field

[ad_1]

Hey, all. How could I implement conditional logic on the form fields for WooCommerce?I have the following array and the woocommerce\_form\_field, so how could I, for example, create another form field based on the option selected, or simply echoing a statement? Thanks!

Edit: Sorry that Reddit code is a mess, but I tried to fix it.

$options = array(
“” => __(‘Select Option’),
“OP1” => “Option1”,
“OP1” => “Option2”,
“OP2” => “Option3”,
“OP3” => “Option4”,
“OP4” => “Option5″,
);

woocommerce_form_field(‘form_field_name’, array(
‘type’ => ‘select’,
‘class’ => array(‘my-field-class form-row-wide’),
‘label’ => __(”, $domain),
‘required’ => true,
‘options’ => $options,
),”
);

​

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer