Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Automatically assign product to listing
- This topic has 4 replies, 2 voices, and was last updated 6 years, 11 months ago by WCFM Forum.
- AuthorPosts
- January 19, 2018 at 11:03 am #18120info17Participant
hi, me again 🙂
at the moment if a vendor have listing he can add product(s) to his listing when creating a product.
but my question is if its possible to auto assign products to vendors listing when he create a product?
on my webseite every vendor can only have one listing thats why will be better it auto assign to this listing. - January 19, 2018 at 11:29 am #18121WCFM ForumMember
Hi,
Yes possible. As your vendors have only one listing then we have to auto-select that in dropdown.
Kindly use this code for the purpose –
function product_manage_fields_autoselect_listings( $listing_fields ) { if( wcfm_is_vendor() ) { if( isset( $listing_fields['wpjm_listings'] ) && isset( $listing_fields['wpjm_listings']['options'] ) ) { $wpjm_listings_array = $listing_fields['wpjm_listings']['options']; if( is_array( $wpjm_listings_array ) && !empty( $wpjm_listings_array ) ) { foreach( $wpjm_listings_array as $wpjm_listing_id => $wpjm_listing_name ) { if( $wpjm_listing_id ) { $listing_fields['wpjm_listings']['value'] = $wpjm_listing_id; } } } } } return $listing_fields; } add_filter( 'product_manage_fields_wpjm_listings', 'product_manage_fields_autoselect_listings' );
please know me is this meet your requirement or not!
Thank You
- January 19, 2018 at 11:35 am #18123info17Participant
hi again, thx it works perfect:) 🙂
can i now hide this fild in ad product and the listing is automatic saved.. because i like to hide this field.
thank you - January 19, 2018 at 11:52 am #18124info17Participant
i ad this to custom css and hide the field and it assign automatic:)
all good here 🙂 🙂div#wcfm_products_manage_form_wpjm_listings_head {
display: none;
} - January 19, 2018 at 12:01 pm #18125WCFM ForumMember
Ahh … that’s great.
- AuthorPosts
- The topic ‘Automatically assign product to listing’ is closed to new replies.