WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Add Hidden shipping fields? (3 posts)

  1. jepzen
    Member
    Posted 1 year ago #

    Hi

    Im trying to customize my checkout page. I want to fill out my shipping fields with some data i get from a webserivce. This works fine with a input field which populates a set of radio buttons, then the user select one option and my values gets copied to the shipping fields. BUT

    I dont know how to hide these fields form the user? They are not supposed to edit them after, only to fill them out with data from my selector.

    I tried

    $address_fields['shipping_company']['type'] = "hidden";

    This will remove the whole field from the form.

    I also tried

    $address_fields['shipping_company']['class'] = array('hide_me');

    Which is a class setting display to none. This way my elements do exist but my script filling out values dont work then.

    How can I make the shipping fields hidden?

    http://wordpress.org/extend/plugins/woocommerce/

  2. torndownunit
    Member
    Posted 1 year ago #

    HI, sorry I can't answer your question but can you tell me what file you edit to completely hide the fields? In my case that is what I need to do.

  3. jepzen
    Member
    Posted 1 year ago #

    I edit the functions.php

    Followed the tutorial here http://wcdocs.woothemes.com/snippets/tutorial-customising-checkout-fields-using-hooks-and-filters/

    This here removes the fields completely

    unset($address_fields['shipping_country']);

    this just applies a class that will hide it
    $address_fields['shipping_company']['class'] = array('hide_me');

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic