Results 1 to 1 of 1

Thread: How to gets athor's meta field's value in order functions.php

  1. #1
    Thread Starter
    mckolt's Avatar
    Join Date
    Feb 2014
    Location
    Poland
    Posts
    183
    Thanks
    14
    Thanked 3 Times in 3 Posts

    How to gets athor's meta field's value in order functions.php

    Hi,
    I have a serious problem with grabbing value of metafield.
    I added external meta field "cp_company_country" by "advanced custom field for classipress" to author profile which he has to fill during registration.
    I would like have tax dependent on this field but I can't grab this value when I'm placing in order-functions.php for example:

    PHP Code:
    "my code"
    $cp_company_country null;
        
    $country = (string)get_the_author_meta'cp_company_country'$user->ID );
            
    $country trim$country ); 
    if (
    $country == 'Germany')  
            {
    $tax_rate 25;}  ; 
    it's grabbing empty value of meta field cp_company_country ...

    When I paste code to form-listing-perview.php for check

    PHP Code:
    <h2 class="dotted"><?php echo get_the_author_meta'cp_company_country'$user->ID ?></h2>
    It's grab and showing me value correctly...


    By the way
    When I want to grab value from ads fields by this code it's ok

    PHP Code:
    $cp_country null;
        
    $items $order->get_items();
        foreach ( 
    $items as $item ) {
        
    $country= (string) get_post_meta$item'post_id' ], 'cp_country'true );
        
    $cp_country = ( strlen$country ) > ) ? $country $cp_country;
        } 
    if (
    $country == 'Germany')  
            {
    $tax_rate 25;}  ; 
    Can anyone help me with this ? I have no idea how to make this after hundreds unsuccessful attempts... I'll pay for help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 11
    Last Post: September 9th, 2014, 04:21 PM
  2. Add meta box on "edit order" page
    By modezonen2010 in forum Help Using JobRoller
    Replies: 1
    Last Post: June 21st, 2013, 10:42 AM
  3. Add meta box on "edit order" page
    By modezonen2010 in forum JobRoller General Discussion
    Replies: 1
    Last Post: June 21st, 2013, 10:42 AM
  4. Classipress META descriptions in the wrong order
    By benjipie in forum Report ClassiPress Bugs
    Replies: 3
    Last Post: February 1st, 2012, 02:32 PM
  5. Reasoning behind putting everything into functions and sub functions?
    By rodeoramsey in forum Report ClassiPress Bugs
    Replies: 12
    Last Post: November 16th, 2011, 11:05 AM