@shyann
To set default values in WooCommerce checkout, you can use the woocommerce_checkout_fields
filter hook in your theme's functions.php file. Here's an example code snippet to set default values for the billing email field in WooCommerce checkout:
1 2 3 4 5 6 7 |
add_filter('woocommerce_checkout_fields', 'set_default_checkout_values'); function set_default_checkout_values($fields) { $fields['billing']['billing_email']['default'] = '[email protected]'; return $fields; } |
In this code snippet, we are using the woocommerce_checkout_fields
filter hook to modify the default value for the billing email field in WooCommerce checkout. You can modify this code to set default values for other fields as well by changing the field key in the $fields
array.
Remember to replace the example email address '[email protected]' with the default value you want to set for the billing email field. You can add additional fields and default values as needed by modifying the code accordingly.