Automatically assign product to listing

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Ultimate Automatically assign product to listing

Viewing 4 reply threads
  • Author
    Posts
    • #18120
      info17
      Participant

      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.

    • #18121
      WCFM Forum
      Member

      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

    • #18123
      info17
      Participant

      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

    • #18124
      info17
      Participant

      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;
      }

    • #18125
      WCFM Forum
      Member

      Ahh … that’s great.

Viewing 4 reply threads
  • The topic ‘Automatically assign product to listing’ is closed to new replies.