Enable all attributes by default

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 Enable all attributes by default

Tagged: , ,

Viewing 7 reply threads
  • Author
    Posts
    • #88207
      coderunknown
      Participant

      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:
      WCFM product attributes

      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.

    • #88555
      WCFM Forum
      Keymaster

      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

    • #88678
      coderunknown
      Participant

      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.

    • #90781
      WCFM Forum
      Keymaster

      OK, so you want to activate all attributes for all products?

    • #90798
      coderunknown
      Participant

      Yes, all attributes need to be active for all products. Because the site will host only 1 type of products (used cars).

    • #91803
      WCFM Forum
      Keymaster

      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

    • #92201
      coderunknown
      Participant

      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.

    • #93392
      WCFM Forum
      Keymaster

      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.  

Viewing 7 reply threads
  • The topic ‘Enable all attributes by default’ is closed to new replies.