Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Feature Request › Access to get_user_meta a or add a new page in dashboard
- This topic has 5 replies, 2 voices, and was last updated 5 years, 2 months ago by WCFM Forum.
- AuthorPosts
- January 8, 2019 at 3:28 am #42582CesarGuest
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
- January 8, 2019 at 6:35 am #42609WCFM ForumKeymaster
HI,
Use this to get store address –
$store_user = wcfmmp_get_store( $vendor_id ); $address = $store_user->get_address();
Thank You
- January 10, 2019 at 3:26 am #42876cesarGuest
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!
- January 10, 2019 at 7:10 am #42895WCFM ForumKeymaster
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
- January 10, 2019 at 10:13 am #42911CesarGuestThis reply has been marked as private.
- January 10, 2019 at 10:50 am #42920WCFM ForumKeymaster
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
- AuthorPosts
- The topic ‘Access to get_user_meta a or add a new page in dashboard’ is closed to new replies.