• Resolved brunohan

    (@brunohan)


    Hi!
    I have used this code (in themes functions.php) to remove order notes field in checkout:

    // remove Order Notes from checkout field in Woocommerce
    add_filter( ‘woocommerce_checkout_fields’ , ‘alter_woocommerce_checkout_fields’ );
    function alter_woocommerce_checkout_fields( $fields ) {
    unset($fields[‘order’][‘order_comments’]);
    return $fields;
    }

    But it has stopped to work… I think it’s because some update of Svea Checkout plugin.

    How can we remove Order Notes field?

    Best regards
    Bruno

    • This topic was modified 1 year, 4 months ago by brunohan.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author The Generation

    (@thegeneration)

    Hi,

    Svea Checkout uses a custom template for the checkout which adds the field which is why that filter doesn’t work unfortunately.

    The best option is to overwrite the template by copying plugins/svea-checkout-for-woocommerce/templates/svea-checkout.php into yourtheme/woocommerce/svea-checkout.php and remove the parts relating to order_comments.

    Another alternative would be something like this:

    function svea_checkout_remove_order_notes( $field, $key ) {
    	if ( $key === 'order_comments' ) {
    		$field = '';
    	}
    
    	return $field;
    }
    add_filter( 'woocommerce_form_field', 'svea_checkout_remove_order_notes', 10, 2 );

    This will make the input field print out nothing. If anything looks wrong after doing this you could use custom CSS to style the page now that the input is gone. Please note that this will remove the input field in the “regular” checkout as well if you’re using other payment gateways as well.

    Best regards

    Thread Starter brunohan

    (@brunohan)

    Hi!
    Thank you for quick response! The code works very well, thank you.

    Best regards
    Bruno

    • This reply was modified 1 year, 4 months ago by brunohan.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove Order Notes’ is closed to new replies.