Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Meet Shah

    (@meet1347)

    Hey, got my answer.

    add_action( ‘save_post’, ‘getVendor’, 10, 3 );

    function getVendor( $post_ID, $post, $update ) {
    if(is_admin()){
    if(($post->post_type==’product’)){
    echo $post->post_author;
    wp_die();
    }
    }

    that gives me ID of the vendor!

    Thanks by the way ??

    Yay! Glad to have helped. ??

    You guessed right, the vendor for the product is simply the post_author. Easy as that! From there you can of course grab any details you want, as all vendor information is stored in the user_meta table so get_user_meta works wonderfully.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Retrieve Vendor from product ID’ is closed to new replies.