Title: Fetch field value in functions.php
Last modified: March 6, 2017

---

# Fetch field value in functions.php

 *  [Lohith M](https://wordpress.org/support/users/lohith-m/)
 * (@lohith-m)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/fetch-field-value-in-functions-php/)
 * Hi Admin, I need to change the woocommerce product price according to the location.
   So I am planning to use Custom field values for different locations as a field
   in product page. So based on the city name i need to fetch the particular field
   value. and based on this i need to change the value of the product.
 * Could you help me out how can i fetch the value of custom field value in functions.
   php file.
 * waiting for your response eagerly and sooner.
 * thanks

Viewing 1 replies (of 1 total)

 *  [sarkparanjothi](https://wordpress.org/support/users/sarkparanjothi/)
 * (@sarkparanjothi)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/fetch-field-value-in-functions-php/#post-8904619)
 * use this filter in your function.php `add_filter('woocommerce_add_cart_item_data','
   call_back_function', 1, 2);`
    it will give all fields value you can change and
   customize its
 *  `function call_back_function($cart_item_data,$product_id){`
    //your stuff `}`
    -  This reply was modified 9 years, 3 months ago by [sarkparanjothi](https://wordpress.org/support/users/sarkparanjothi/).

Viewing 1 replies (of 1 total)

The topic ‘Fetch field value in functions.php’ is closed to new replies.

 * ![](https://ps.w.org/wc-fields-factory/assets/icon-128x128.jpg?rev=2738843)
 * [WC Fields Factory](https://wordpress.org/plugins/wc-fields-factory/)
 * [Support Threads](https://wordpress.org/support/plugin/wc-fields-factory/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-fields-factory/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-fields-factory/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-fields-factory/reviews/)

## Tags

 * [field](https://wordpress.org/support/topic-tag/field/)
 * [functions](https://wordpress.org/support/topic-tag/functions/)
 * [value](https://wordpress.org/support/topic-tag/value/)

 * 1 reply
 * 2 participants
 * Last reply from: [sarkparanjothi](https://wordpress.org/support/users/sarkparanjothi/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/fetch-field-value-in-functions-php/#post-8904619)
 * Status: not resolved