shop_vendor Term association with user_id
-
Hi,
I am facing a strage situation while doing some custom development using this plugin.
I am creating product via code with some custom inputs via fomrs in front-end.
I have reverse engineer shop_vendor term saving via wc_vendor plugin and updating it accordingly, find code below.
$vendorUserObject = get_user_by(‘id’, $post->post_author);
$vendorFname = ($vendorUserObject->first_name != null) ? $vendorUserObject->first_name.” ” : ”;
$vendorLname = ($vendorUserObject->last_name != null) ? $vendorUserObject->last_name.” ” : ” ;
$vendorName = $vendorFname.$vendorLname;
$vendorFullName = ($vendorName != null ) ? $vendorName : $vendorUserObject->user_login;$termIdArr = wp_set_object_terms($productId, $vendorFullName, ‘shop_vendor’);
//debug checkpoint
if ( is_wp_error( $termIdArr ) ) {
exit(‘Error in assigning the shop_vendor term’);
}$term_option_key = ‘shop_vendor_’.$termIdArr[0];
$term_option_value = array(
‘admins’ => array($post->post_author),
‘commission’ => 100,
‘paypal_email’ => ”);
update_option($term_option_key, $term_option_value);Note: $post->post_author , having user_id, everything is populating in term edit section in backendm option for term is saved like:
‘shop_vendor_91’ > assume 91 is term id for shop_vendor taxonomy, But when i logged in using vendor details, it doesn’t associate this term with vendor user_id so i can not see the products and booking section ?
can you please help me with that, i think there is something still missing that’s being populated once we save term from backend. rather than the option that contains term meta,
Help is much appreciated !!
- The topic ‘shop_vendor Term association with user_id’ is closed to new replies.