Viewing 6 replies - 1 through 6 (of 6 total)
  • Seriously mods, why do you close topics like that? with no answer, and an obviously real question. It just makes these forums worse because it forces people to answer in the wrong place!

    All topics are closed automatically when they are 12 months old.

    Which serves what purpose exactly?

    At risk of sounding silly, where does this bit if code go? Info is still not saving to my order. The code I have at the end of my functions.php file is:

    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields6' );
    
    // Our hooked in function - $fields is passed via the filter!
    function custom_override_checkout_fields6( $fields6 ) {
         $fields6['billing6']['billing_infos6'] = array(
            'type'      => 'textarea',
            'label'     => __('Alternate Contact Info', 'woocommerce'),
        'placeholder'   => _x('', 'placeholder', 'woocommerce'),
        'required'  => false,
        'class'     => array('form-row-wide'),
        'clear'     => true
         );
         return $fields6;
    }
    
    /**
     * 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 ( ! empty( $_POST['billing6'] ) ) {
            update_post_meta( $order_id, 'Alternate Contact Info', sanitize_text_field( $_POST['billing6'] ) );
        }
    }

    Thanks so much for your time!

    Thread Starter Bid13 Storage Auctions

    (@deweydb)

    Dude, i’m really sorry but this was a really long time ago and i don’t remember. Also its possible you are working with a newer version of woo commerce from when i posted this, so things might have changed. ??

    Thanks so much, I just got some traction on this like 5 minutes ago, I think I’ll finally get this fixed up. Really appreciate your time!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[solved] Custom Checkout fields not saved to order meta’ is closed to new replies.