Access to get_user_meta a or add a new page in dashboard

WooCommerce Multivendor Marketplace – Home Forums WCfM – Feature Request Access to get_user_meta a or add a new page in dashboard

This topic contains 5 replies, has 2 voices, and was last updated by WCfM Forum WCfM Forum 2 months, 1 week ago.

  • Author
    Posts
  • #42582
    Avatar
    Cesar

    Hi everyone, i’m doing a new shipping method, and i need vendor address. First i tried to access through get_user_meta($user_id or $vendor_id, ‘_wcfm_city’) , and i didn’t get value of this meta (i’ve already put value in settings of a test vendor).

    I did print_r( $package) before checkout filter and $vendor_id appear as [protected], i think this is why i didn’t. Get meta value.

    So, if i can’t do this by get_user_meta, how can i put a new page of setting for vendors with two select dropdown and a text field, for address sender that i can Access from my custom shipping method?.

    Thanks

  • #42609
    WCfM Forum
    WCfM Forum
    Keymaster

    HI,

    Use this to get store address –

    $store_user  = wcfmmp_get_store( $vendor_id );
    $address     = $store_user->get_address();

    Thank You

  • #42876
    Avatar
    cesar

    Thanks, this helped me, but only when i put manually the $vendor_id, eg:
    $store_user = wcfmmp_get_store( 2 );

    have i declare where take $vendor_id?? when i put just like you post, doesn´t work. Do not return any data, but when i put some vendor id manually, work perfect.

    Thanks A Lot!

  • #42895
    WCfM Forum
    WCfM Forum
    Keymaster

    Hi,

    Well, you have to get $vendor_id dynamically, you can not set this static.

    Suppose, you are on a single product page then you have to generate that product’s vendor_id.

    Between, where you are using this code? In which page?
    I will know you , how you can generate vendor_id for that page!

    Thank You

  • #42911
    Avatar
    Cesar
    This reply has been marked as private.
  • #42920
    WCfM Forum
    WCfM Forum
    Keymaster

    Hi,

    You require code like this –

    foreach (WC()->cart->get_cart() as $item) {
    if ($item['data']->needs_shipping()) {
    $product_id = $item['product_id'];
    $vendor_id = $WCFM->wcfm_vendor_support->wcfm_get_vendor_id_from_product( $product_id );
    }
    }

    An other question is how can i set that for each group of parcel of diferent vendors have to make a new calculate because could be diferent origin.
    – You have to group cart items as per vendor.

    Thank You

The topic ‘Access to get_user_meta a or add a new page in dashboard’ is closed to new replies.