Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #16883

    Hi Abundance,

    I customized my Checkout page to include a Recipient Phone Number on my site’s checkout page. (www.blossomsonabudget.net)

    After filling out the phone number, my customers still get “Please enter phone number” at the top of the page– despite having done so. Can someone please tell me how to correct this problem?

    Thank you,

    Minnoe

    #93264

    P.S. if it is easier to simply give me a piece of code that overrides the phone number as a required field I am fine with that too– though I would prefer it be a required field. But anything to solve this issue quickly.

    Thanks!

    #93265

    Hey Minnoe,

    You’ll need to check with the WooCommerce forums about. We are a bit limited when it comes to actually modifying or effecting the plugin functions outside of what the theme already customizes.

    Just a quick search through the docs however I found what you’ll need here: http://wcdocs.woothemes.com/snippets/tutorial-customising-checkout-fields-using-hooks-and-filters/

    Regards,

    Devin

    #93266

    Okay Thank you Devin.

    Dude/Peter if you happen to read this you were kind enough to give me the original code to put those two text fields in so if you happen to have an answer do let me know!

    Thank you,

    Minnoe

    #93267

    p.s. the code given to me @ the time was this:

    /**

    * Add the field to the checkout

    **/

    add_action(‘woocommerce_after_order_notes’, ‘minnoe_ordernotes_custom_checkout_field’);

    function minnoe_ordernotes_custom_checkout_field( $checkout ) {

    echo ‘<div id=”my_custom_checkout_field”><h3>’.__(‘Delivery Date’).'</h3>';

    woocommerce_form_field( ‘delivery_date_name’, array(

    ‘type’ => ‘text’, ‘class’ => array(‘delivery-date-class form-row-wide’),

    ‘label’ => __(‘Eg. Tues, July 22.’),

    ‘placeholder’ => __(‘Date of Delivery’),

    ), $checkout->get_value( ‘my_field_name’ ));

    echo ‘</div>';

    }

    /**

    * Process the checkout

    **/add_action(‘woocommerce_checkout_process’, ‘minnoe_delivery_custom_checkout_field_process’);

    function minnoe_delivery_custom_checkout_field_process() {

    global $woocommerce;

    // Check if set, if its not set add an error.

    if (!$_POST)

    $woocommerce->add_error( __(‘Please enter delivry date.’) );

    }

    /** * Update the order meta with field value

    **/

    add_action(‘woocommerce_checkout_update_order_meta’, ‘minnoe_delivery_custom_checkout_field_update_order_meta’);

    function minnoe_delivery_custom_checkout_field_update_order_meta( $order_id ) {

    if ($_POST) update_post_meta( $order_id, ‘Delivery Date’, esc_attr($_POST));

    }

    /**

    * Add the field to the checkout

    **/

    add_action(‘woocommerce_after_order_notes’, ‘minnoe_notes_custom_checkout_field’);

    function minnoe_notes_custom_checkout_field( $checkout ) {

    echo ‘<div id=”my_custom_checkout_field”><h3>’.__(‘Recipeint Phone’).'</h3>';

    woocommerce_form_field( ‘recipient_phone_name’, array(

    ‘type’ => ‘text’, ‘class’ => array(‘recipient-phone-class form-row-wide’),

    ‘label’ => __(‘Home & or Cell’),

    ‘placeholder’ => __(‘Both numbers would be great!’),

    ), $checkout->get_value( ‘recipeint_phone_name’ ));

    echo ‘</div>';

    }

    /**

    * Process the checkout

    **/add_action(‘woocommerce_checkout_process’, ‘minnoe_custom_checkout_field_process’);

    function minnoe_custom_checkout_field_process() {

    global $woocommerce;

    // Check if set, if its not set add an error.

    if (!$_POST)

    $woocommerce->add_error( __(‘Please enter phone number.’) );

    }

    /** * Update the order meta with field value

    **/

    add_action(‘woocommerce_checkout_update_order_meta’, ‘minnoe_custom_checkout_field_update_order_meta’);

    function minnoe_custom_checkout_field_update_order_meta( $order_id ) {

    if ($_POST) update_post_meta( $order_id, ‘Recipient Phone’, esc_attr($_POST));

    }

    #93268

    In the link to woo commerce it says to add this in order to make the phone number so that it isn’t a required field but my site simply goes blank when i add it to the functions. php file:

    <?phpadd_filter( ‘woocommerce_billing_fields’, ‘wc_npr_filter_phone’, 10, 1 );function wc_npr_filter_phone( $address_fields ) { $address_fields = false; return $address_fields;}?>

    #93269

    Well I would just like everyone to know that there is this woocommerce plugin you can buy at 61 Extensions that allows you to customize the check out field. Ironically, they use the Abundance theme to sell their downloads.

    Cheers.

    #93270

    Probably you need to insert the code above without the php tags – you just need to insert following code at the very bottom of functions.php:

    add_filter( 'woocommerce_billing_fields', 'wc_npr_filter_phone', 10, 1 );
    function wc_npr_filter_phone( $address_fields ) { $address_fields['billing_phone']['required'] = false; return $address_fields;}

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Customers Unable to Place Order’ is closed to new replies.