Created
October 3, 2019 08:23
-
-
Save ncyhere/e1fa1496272a9a11d35ac3ec034a375d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @snippet Shipping Phone in WooCommerce Checkout | |
* @author Ncy Design https://wordpress.ncy.design | |
* @compatible WooCommerce 3.7.0 | |
*/ | |
add_filter( 'woocommerce_checkout_fields', 'ncydesign_shipping_phone_checkout' ); | |
function ncydesign_shipping_phone_checkout( $fields ) { | |
$fields['shipping']['shipping_phone'] = array( | |
'label' => 'Phone', | |
'required' => false, | |
'class' => array( 'form-row-wide' ), | |
'priority' => 25, | |
); | |
return $fields; | |
} | |
add_action( 'woocommerce_admin_order_data_after_shipping_address', 'ncydesign_shipping_phone_checkout_display' ); | |
function ncydesign_shipping_phone_checkout_display( $order ){ | |
echo '<p><b>Shipping Phone:</b> ' . get_post_meta( $order->get_id(), '_shipping_phone', true ) . '</p>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment