Home Forums UnTheme Mentis Unset Checkout field

Viewing 3 reply threads
  • Author
    Posts
    • #94592

      Lola conde
      Participant

      Good morning,

      I have tried to hide billing data in the order page because I sell digital products but it does not hide them with the plugins.
      And I can’t find where I can modify it in the code.

      Could you help me?

      This is the code.

      add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’ );
      function custom_override_checkout_fields( $fields ) {

      unset($fields[‘billing’][‘billing_first_name’]);

      unset($fields[‘billing’][‘billing_last_name’]);

      unset($fields[‘billing’][‘billing_company’]);

      unset($fields[‘billing’][‘billing_address_1’]);

      unset($fields[‘billing’][‘billing_address_2’]);

      unset($fields[‘billing’][‘billing_city’]);

      unset($fields[‘billing’][‘billing_postcode’]);

      unset($fields[‘billing’][‘billing_country’]);

      unset($fields[‘billing’][‘billing_state’]);

      unset($fields[‘billing’][‘billing_phone’]);

      unset($fields[‘order’][‘order_comments’]);

      unset($fields[‘billing’][‘billing_address_2’]);

      unset($fields[‘billing’][‘billing_postcode’]);

      unset($fields[‘billing’][‘billing_company’]);

      unset($fields[‘billing’][‘billing_last_name’]);

      unset($fields[‘billing’][‘billing_email’]);

      unset($fields[‘billing’][‘billing_city’]);

      unset( $tabs[‘additional_information’] );

      return $fields;

      }

      add_filter(‘woocommerce_enable_order_notes_field’, ‘__return_false’);

      Thanks,

      Lola

    • #94636

      Maria Do
      Keymaster

      Hey there!
      item support does not include: Customization services

      However you can do this a couple ways:

      with a plugin: https://www.woocommerce.com/products/woocommerce-checkout-field-editor/
      With code:
      Depending on the type of products you are selling via a WooCommerce store, sometimes you don’t need the billing and shipping address details on the WooCommerce checkout page.

      For example when purchasing a simple virtual product. We just want to send the user to Payment without any hassle.

      Base on your requirement you can achieve disable billing address by below code put into functions.php file.

      You can modify the checkout page by placing different logic inside a function.

      add_action(‘woocommerce_checkout_init’,’disable_billing’);
      function disable_billing($checkout){
      $checkout->checkout_fields[‘billing’]=array();
      return $checkout;
      }
      Hope this helps

    • #94638

      Lola conde
      Participant

      Thanks for your support! 🙂

    • #94639

      Maria Do
      Keymaster

      You are very welcome!
      It would be great if i can ask your help with 5 star and Good Review on themeforest.
      You can do it on download page at themeforest, screen: http://prntscr.com/6x3k63
      Just need some words.
      From bottom my heart thank you so much!!!!

Viewing 3 reply threads
  • You must be logged in to reply to this topic.