• Hello,
    i am strugling for hours on simple task. Via function/hook i created custom field on checkout page for mobile phone.

    // Hook in
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    
    // Our hooked in function - $fields is passed via the filter!
    function custom_override_checkout_fields( $fields ) {
         $fields['billing']['shipping_phone'] = array(
            'label'     => __('Phone Iphone', 'woocommerce'),
        'placeholder'   => _x('Phone', 'placeholder', 'woocommerce'),
        'required'  => false,
        'class'     => array('form-row-wide'),
        'clear'     => true
         );
    
         return $fields;
    }
    

    now i open thankyou template and add

     <? echo '<p><strong>'.__('Phone From Checkout Form').':</strong> ' . get_post_meta( $order->id, '_shipping_phone', true ) . '</p>';  ?>
    

    But i dont get value from shipping phone ?? just get that strong text printed adn thats it.

Viewing 1 replies (of 1 total)
  • Hi,

    It is not enough to add the field, you need to save it too.

    There is a good guide on this page, which get you through the process of adding custom checkout fields :).

    • This reply was modified 7 years, 10 months ago by beamkiller.
Viewing 1 replies (of 1 total)
  • The topic ‘Custom field on thank you page’ is closed to new replies.