WooCommerce remove checkout fields

Using a Theme "Directory" by Templatic
and child theme "Spotfinder"
I have "woocommerce" Plugin installed

http://directory.dinethenation.com

I am trying to remove some unnecessary fields from the "woocommerce" checkout page

I have watched this video:
https://www.youtube.com/watch?v=EPpIr1837q8
as well as read many post but I can't get it to work.

I have followed instructions but it seems to break my theme when I insert the code into the child themes "function.php"

// 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 ) {
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_phone']);
unset($fields['billing']['billing_company’]);

return $fields;
}

not sure now if I am placing it into the correct file
If someone could please help I would appreciate it

I am more of a designer than a coder so as specific as possible would help.

Thanks JIM

  • Vinod Dalvi

    Hi JIM,

    Thanks for posting on the forum.

    I have followed instructions but it seems to break my theme when I insert the code into the child themes "function.php"

    Could you please use the shared code and try enabling WP_DEBUG mode and debug logging? To do this, just go to wp-config.php include this:

    define('WP_DEBUG',true);
    define('WP_DEBUG_LOG',true);

    You might already have a line for WP_DEBUG, so just make sure it's set to true. This will create a log file under wp-content/debug.log with detailed information.

    If you'd like to avoid end users seeing error messages, you can include this as well:

    @ini_set('display_errors',0);
    define('WP_DEBUG_DISPLAY', false);

    This will prevent errors from being displayed, but you can still find them in the log file. For information on this, checkout this wpmu.org article.

    Let me know what errors if any you are getting!

    Does the code work fine if you use default WordPress theme like Twenty Thirteen?

    Would you mind if I logged in to your site and try to remove these fields myself? This might help get to the bottom of this faster. If this is ok, just send log in info through our secured contact form: https://premium.wpmudev.org/contact/
    - Choose "I have a different question"
    - Include my name in the subject "Vinod Dalvi"
    - Include the URL of this post in your message so that I may track this issue better
    - Include login information (Wordpress admin info username + password )
    - Include FTP Details

    Kind Regards,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.