Cann't get variabel POST from custom checkout field in calculate shipping (1 post)

  1. muazfa
    Posted 3 years ago #


    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' ?


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic