WordPress.org

Support

Support » Plugins and Hacks » Cann't get variabel POST from custom checkout field in calculate shipping

Cann't get variabel POST from custom checkout field in calculate shipping

  • Hi,

    I have plugins for extension woocommerce shipping methods. And then i want to calculate shipping based on costume shipping checkout field. I have read docs from http://wcdocs.woothemes.com/snippets/tutorial-customising-checkout-fields-using-actions-and-filters/ for adding fields to billing/shipping/checkout fields. I have written code like the example. But the problem is i couldn’t get variable POST from ‘my_field_name’ at calculate shipping function.

    At the previous of extension woocommerce shipping methods that i have, i just get variable POST from ‘state’.

    function calculate_shipping( $package = array() ) {
    
    ---------------
    $state = (isset($_POST['state']))?$_POST['state']:$package['destination']['state'];
    ----------------

    The above code can run well. But if:

    $state = (isset($_POST['my_field_name']))?$_POST['my_field_name']:$package['destination']['my_field_name']

    I cann’t get variable POST from ‘my_field_name’.

    Could you help me, how to get variable POST from ‘my_field_name’ ?

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

  • The topic ‘Cann't get variabel POST from custom checkout field in calculate shipping’ is closed to new replies.