Allow vendor to choose only one term for a specific attribute

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 Product Vendors Allow vendor to choose only one term for a specific attribute

Viewing 6 reply threads
  • Author
    Posts
    • #21150
      leon.liangsl
      Participant

      Hello WC Lovers Team,

      I bought the ultimate addon and I’m loving it. Thank you for the great product.

      I do have a question though: is there a way to limit all vendors to select only one term for a specific attribute?
      Say, I have an attribute called City and I’ve about 300 terms under this attribute. When a vendor adds a product, they can only select one from the terms (the default setting has an option to select all terms, which is not what I want). Is there a way to do so please?

      My vendors are selling services (interpreting etc.) that requires the interpreter to choose the city they can provide the service in. So I need the attribute of “city” but for each product they publish, only one city can be chosen.

      Thank you
      Leon

    • #21151
      WCFM Forum
      Member

      Hi,

      Thanks fro get in touch with us and it’s pleasure to know that you have very much liked WCfM 🙂

      Well, I understand your requirement. Can you please add this code to your site for the purpose –

      function wcfm_restrict_attribute_limit( $limit ) {
      	$limit = 1;
      	return $limit;
      }
      add_filter( 'wcfm_attribute_limit', 'wcfm_restrict_attribute_limit' );

      Please know me is this resolve your purpose or not!

      Thank You

    • #21152
      leon.liangsl
      Participant

      Hi,

      Thank you for your quick support!!

      I haven’t added the code yet, but I guess it will limit all attributes. However, for some attributes, I need vendors to be able to select multiple terms. Say, I have another attribute called: Language. Terms like English, Spanish, Russian etc. will be under that attribute. Since a vendor may speak more than one language, they should be able to select multiple terms for this attribute.

      So basically, If there is a way to limit certain attributes to single term and some are multiple, that’ll be ideal.

      Is it possible please?

      Thank you!
      Leon

    • #21175
      WCFM Forum
      Member

      Hi,

      Yeah you are right, it will set limit for all attributes.

      But it also possible to set limit individually, for that please know me exact slug for “City” attribute. It will be best if you show me screenshot for that attribute edit page.

      Thank You

    • #21401
      leon.liangsl
      Participant

      Hello,

      Here is the snapshot. https://ibb.co/bzwfWc

      The slug is “city”.

      I also need to make sure the Gender (slug “gender”) can only select one as well.

      Thanks
      Leon

    • #21415
      WCFM Forum
      Member

      Hi,

      Thanks for the info. Kindly use this code for the purpose –

      function wcfm_attribute_limit_to_one( $attrlimit, $att_taxonomy ) {
      	return 1;
      }
      add_filter( 'wcfm_attribute_limit_pa_city', 'wcfm_attribute_limit_to_one', 10, 2);
      add_filter( 'wcfm_attribute_limit_pa_gender', 'wcfm_attribute_limit_to_one', 10, 2);

      Please be sure your WCfM Ultimate version 4.0.2 and know me is this works for you or not!

      Thank You

    • #21723
      WCFM Forum
      Member

      Hi,

      Is this worked for you?

      Thank You

Viewing 6 reply threads
  • The topic ‘Allow vendor to choose only one term for a specific attribute’ is closed to new replies.