Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author ronald_edelschaap

    (@ronald_edelschaap)

    Hi Tom,

    My plugin doesn’t do that, but you might wanna take a look at this small script: https://gist.github.com/BFTrick/7873168. You can do the same for the shipping fields, so you don’t have to load my plugin and it’s js file (saves only an HTTP request and some kb of PHP code, but still :p)

    Thread Starter tomkerswill

    (@tomkerswill)

    Hi Ronald,

    Sorry for the delay. Ah, that’s great – thanks for the pointer! I’ll have a play…

    Tom

    Thread Starter tomkerswill

    (@tomkerswill)

    Hi Ronald,

    Thanks once again for this. The code you linked to works well, but there’s a massive advantage of your plugin over this. WooCommerce doesn’t dynamically update the address field code when changing shipping method. So if the user changes shipping method on the checkout screen, the address won’t be dynamically shown or hidden at that point. The only way to really do that is to use javascript, which your code does really well. So the code above is good for static changes only; yours is better because it dynamically shows and hides the shipping fields.

    If you ever do get a chance to add in support for billing fields, I think that would be absolutely great. I’ve had a look at the JS code, but it looks like it could be fairly tricky to do…

    Thanks once again,

    Tom

    Plugin Author ronald_edelschaap

    (@ronald_edelschaap)

    Hi Tom,

    I didn’t know you wanted to have multiple shipping methods active at the same time. I’m not planning to add support for billing fields for now, but if you look change

    t = jQuery( '.woocommerce-shipping-fields-cnt' )

    to

    t = jQuery( '.woocommerce-billing-fields, .woocommerce-shipping-fields-cnt' )

    at line 9 in the JS file it probably does what you want.

    Thread Starter tomkerswill

    (@tomkerswill)

    Perfect – that works great. I did a few modifications to target individual fields and it all works really seamlessly.

    Thanks once again,

    Tom

    Plugin Author ronald_edelschaap

    (@ronald_edelschaap)

    You’re very welcome! Good luck with your shop!

    hi Tom,
    I am a newbie to WP and Woocommerce and what you describe is exactly what i wanted to do. i.e. to hide both the billing and shipping addresses.
    Appreciate if you can guide me exactly what I need to do to achieve this using Ronald advise? Where to put the code? Use the php file or simply amend the js file in the plugin directory?
    Thanks!

    Thread Starter tomkerswill

    (@tomkerswill)

    Hi kmchow

    Thanks for the message. The file the Ronald mentions is in the directory for this plugin. So the first step is to install the plugin. Then take a look at your WordPress installation using a SSH or an FTP client, and go to wp-content/plugins/woocommerce-hide-checkout-shipping-address/js

    Now take a backup copy of the javascript file you find there (hide-checkout-shipping-address.js) and then edit the file to make the changes that Ronald mentions above.

    If you don’t have FTP access, then you can also edit the file in the backend admin console of WordPress — but FTP is usually safer (although for a .js file it shouldn’t matter).

    Tom

    Hi Tom,
    Thanks for you reply and instructions. It worked indeed. However, it worked so well that it also removes the Billing Name, Last Name, Email and contact fields. Or am I missing some settings? So, when customer selects Local Pickup, I am not able to capture customer contact details. How can I hide ONLY the Billing ADDRESS fields?
    Thanks.

    Plugin Author ronald_edelschaap

    (@ronald_edelschaap)

    Hi kmchow,

    You could replace .woocommerce-billing-fields with the id’s of the individual fields, or put a container div with a specific id or class around the billing address fields and replace .woocommerce-billing-fields with that id or class.

    hi Ronald,
    Thanks for the reply but can you provide me the specific statement to remove ‘billing_address_1’ and ‘billing_address_2’? My apology for not knowing the syntax and jQuery lingo and what billing fields ids meant.
    e.g.
    t = jQuery( ‘billing_address_1, billing_address_2, .woocommerce-shipping-fields-cnt’ ) ??

    Thanks in adv. Much appreciated.

    Plugin Author ronald_edelschaap

    (@ronald_edelschaap)

    Hi kmchow,

    With jQuery you can select elements with selectors matching their class or id attributes. When you have a div <div id="element-1" class="a-class">...</div>, you can select that element with either jQuery('#element-1'), jQuery('.a-class') or even jQuery('#element-1.a-class'). Multiple elements can be separated with commas: jQuery('#billing_address_1, #billing_address_2, .woocommerce-shipping-fields-cnt').

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Hide billing fields as well’ is closed to new replies.