Skip to content

Commit

Permalink
Removed the hook 'woocommerce_after_shipping_rate' as the fields are …
Browse files Browse the repository at this point in the history
…displaying in the shipping form
  • Loading branch information
mamatharao05 committed Feb 2, 2024
1 parent 50f6662 commit 2d9e565
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions includes/ECommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public function __construct( Container $container ) {
add_action('before_woocommerce_init', array( $this,'hide_woocommerce_set_up') );
add_filter( 'woocommerce_checkout_fields' , array( $this,'swap_billing_shipping_fields'), 10, 1 );
add_filter('woocommerce_shipping_fields', array( $this,'add_phone_number_email_to_shipping_form'), 10, 1 );
//add_action('woocommerce_after_shipping_rate', array( $this,'display_custom_shipping_fields'), 20, 2);
add_action('woocommerce_checkout_create_order', array( $this, 'save_custom_shipping_fields' ), 10, 1);
add_action('woocommerce_admin_order_data_after_shipping_address', array( $this, 'display_custom_shipping_fields_in_admin' ), 10, 1 );

Expand Down Expand Up @@ -388,32 +387,7 @@ public function add_phone_number_email_to_shipping_form($fields) {
return $fields;
}

/**
* Display phone number and Email field on the shipping form
*/
public function display_custom_shipping_fields($method, $index) {
echo '<div class="shipping-phone">';
woocommerce_form_field('shipping_phone', array(
'type' => 'tel',
'class' => array('form-row-wide'),
'label' => __('Phone Number', 'wp_module_ecommerce'),
'placeholder' => __('Enter your phone number', 'wp_module_ecommerce'),
'required' => true,
), '');
echo '</div>';

echo '<div class="shipping-email">';
woocommerce_form_field('shipping_email', array(
'type' => 'email',
'class' => array('form-row-wide'),
'label' => __('Email Address', 'wp_module_ecommerce'),
'placeholder' => __('Enter your email address', 'wp_module_ecommerce'),
'required' => true,
), '');
echo '</div>';
}

/**
/*
* Save phone number and email fields to order meta
*/
function save_custom_shipping_fields($order) {
Expand Down

0 comments on commit 2d9e565

Please sign in to comment.