Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › Enable all attributes by default
Tagged: attributes, Bug, wcfm
- This topic has 7 replies, 2 voices, and was last updated 5 years ago by WCFM Forum.
- AuthorPosts
- October 22, 2019 at 11:43 am #88207coderunknownParticipant
Hello and really awesome plugin by you guys. Can you please help me archive the following: I need all the attributes to be active (& expanded) like shown in this pic. Right now one has to click the active box for each product which soon becomes an headache:
Can you guys provide some code/filter to pull it off? Even better if the active checkbox is also hidden. I tried a solution back from 2018 but the filter name changed and when I tried porting the solution, it won’t work in latest WCFM. I tried a few other solution like removing the JS trigger but that just broke the tab part. Really appreciate any kind of help.
Also I may have found a bug: wcfm-view-products-manage-tabs.php template is not overrideable. I even copied the entire products-manager folder just to be sure that the tabs file is not dependent on other template yet it won’t work. Other templates from enquiry or products folder overrides just fine.
And finally a big request: If possible in future please format the plugin code. VSCode/Sublime Text shows massive gap in the code. I had to manually format the plugin every time it updates.
- October 23, 2019 at 2:54 pm #88555WCFM ForumMember
HI,
Please check this code snippet – https://docs.wclovers.com/tweaks/#set-attributes-required
Using this we have set Attributes as required field for product.
Thank You
- October 23, 2019 at 8:32 pm #88678coderunknownParticipant
I think you misinterpreted my question. What I am trying to achieve is all attributes to be active i.e. Have the “Active?” box ticked and the attribute console expanded so client won’t have to manually activate each attribute for every product. I am still trying to achieve this from my end but if you guys can offer some kind of help, will be really wonderful.
- November 5, 2019 at 4:57 pm #90781WCFM ForumMember
OK, so you want to activate all attributes for all products?
- November 5, 2019 at 5:35 pm #90798coderunknownParticipant
Yes, all attributes need to be active for all products. Because the site will host only 1 type of products (used cars).
- November 11, 2019 at 5:10 pm #91803WCFM ForumMember
HI,
Please add this code to your site –
add_filter( 'wcfm_product_custom_attributes', function( $taxonomy_fields, $att_taxonomy ) { if( isset( $taxonomy_fields[$att_taxonomy] ) && isset( $taxonomy_fields[$att_taxonomy]['value'] ) ) { $attributes = $taxonomy_fields[$att_taxonomy]['value']; $wcfm_attributes = array(); if( !empty( $attributes ) ) { foreach( $attributes as $acnt => $wcfm_attribute ) { $wcfm_attributes[$acnt] = $wcfm_attribute; $wcfm_attributes[$acnt]['is_active'] = 'enable'; $wcfm_attributes[$acnt]['is_visible'] = 'enable'; } } $taxonomy_fields[$att_taxonomy]['value'] = $wcfm_attributes; } return $taxonomy_fields; }, 50, 2);
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/Thank You
- November 14, 2019 at 12:33 am #92201coderunknownParticipant
TYSM for the code. Now I realized where I made the error. Instead of looping through all the attributes, I tried to bruteforce the ‘enable’ values to all attributes at once. Obviously it didn’t register. Really appreciate the help. Keep up the good work.
- November 22, 2019 at 11:00 am #93392WCFM ForumMember
You are always welcome 🙂
Let me know if there’s anything else we can help you with.
Can we ask for a favor? Would you mind taking a few minutes to review our plugin at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers.
- AuthorPosts
- The topic ‘Enable all attributes by default’ is closed to new replies.