How to insert database value into function
-
Hi,
I want to change the function for calculate shipping fee for woocommerce. Now the function calculate shipping from server location, But I want to change the function so it can calculate from seller location in database, not server location.
This is the functionpublic function init_form_fields() { global $woocommerce; global $myongkir; global $wpdb; $mylink = $wpdb->get_row( "SELECT * FROM wp_usermeta WHERE user_id='1' AND meta_key= 'billing_city'", ARRAY_A ); if ( $this->isset_rajaongkir_api() ) { $this->form_fields = array( 'enabled' => array( 'title' => 'Enable/Disable', 'type' => 'checkbox', 'default' => 'no', 'label' => 'Enable this shipping method', ), 'base_city' => array( 'title' => __( 'Your Base City', 'woocommerce' ), 'type' => 'select', 'id' => 'woocommerce_myongkir_base_city', 'class' => 'chosen_select', 'description' => __( 'This is your store location, used for origin package. Require api key is setted, before showing available city.', 'woocommerce' ), 'options' => $myongkir->get_cities($mylink->meta_value) ), 'courier' => array( 'title' => __( 'Your couriers', 'woocommerce' ), 'type' => 'select', 'id' => 'woocommerce_myongkir_couriers', 'class' => 'chosen_select', 'description' => __('This is the avaibility of yours couriers', 'woocommerce' ), 'options' => array( 'all' => 'All', 'aaa' => 'aaa', 'bbb' => 'bbb', 'ccc'=> 'ccc', ), ), ); } }
I’ve found seller location in wp_usermeta table, but when I change the function base_city value to database value, the function didn’t work correctly. Do you know how I can change base_city value to database value ?
Thank you
- The topic ‘How to insert database value into function’ is closed to new replies.