Support » Plugins and Hacks » Adding Drop Down menu to checkout

Adding Drop Down menu to checkout

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mike Jolley


    If you google it, I think there is a plugin for adding custom checkout fields through a UI. Might be easier for you. I’m also developing one.

    Yeah, but im trying to find a way to do it without having to buy a $40 plugin. I only need to add one additional drop down box any ways, so I dont think its worth it honestly. I just want to know how to code it. I’ll post what I have so far:

     * Add the field to the checkout**/
    add_action('woocommerce_after_order_notes', 'social_good_field');
    function social_good_field( $checkout ) {
        woocommerce_form_field( 'social good', array(
            'type'          => 'select',
            'class'         => array('my-field-class form-row-wide'),
            'label'         => __('Social Good'),
    		'clear' => false,
    		'options' => array(
    		'Good 1' => __( 'Montserrat', 'woocommerce' ),
    		'Good 2' => __( 'Morocco', 'woocommerce' ),
    		'Good 3' => __( 'Mozambique', 'woocommerce')
    		$checkout->get_value( 'social good' ));
     * Process the checkout**/
    add_action('woocommerce_checkout_process', 'my_custom_checkout_field_process');
    function my_custom_checkout_field_process() {
        global $woocommerce;
        // Check if set, if its not set add an error.
        if (!$_POST['social good'])
             $woocommerce->add_error( __('Please select a social good.') );
     * Update the order meta with field value**/
    add_action('woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta');
    function my_custom_checkout_field_update_order_meta( $order_id ) {
        if ($_POST['social good']) update_post_meta( $order_id, 'Social Good', esc_attr($_POST['social good']));

    I am looking to do the same thing. Were you able to solve this problem?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding Drop Down menu to checkout’ is closed to new replies.