Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › Product Vendors › Allow vendor to choose only one term for a specific attribute
- This topic has 6 replies, 2 voices, and was last updated 6 years, 7 months ago by WCFM Forum.
- AuthorPosts
- April 1, 2018 at 5:34 am #21150leon.liangslParticipant
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 - April 1, 2018 at 6:08 am #21151WCFM ForumMember
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
- April 1, 2018 at 6:39 am #21152leon.liangslParticipant
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 - April 1, 2018 at 10:51 pm #21175WCFM ForumMember
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
- April 6, 2018 at 2:17 pm #21401leon.liangslParticipant
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 - April 6, 2018 at 4:16 pm #21415WCFM ForumMember
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
- April 13, 2018 at 8:28 am #21723WCFM ForumMember
Hi,
Is this worked for you?
Thank You
- AuthorPosts
- The topic ‘Allow vendor to choose only one term for a specific attribute’ is closed to new replies.