Is there a way to display the "About" tab as default instead of "Products" tab

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 WC Vendors Is there a way to display the "About" tab as default instead of "Products" tab

Viewing 2 reply threads
  • Author
    Posts
    • #112221
      Matt Flood
      Participant

      Is there a way to display the “About” tab as default instead of “Products” tab on the store detail page?

    • #112237

      Hi,

      add_filter('wcfmp_store_default_query_vars',function($tab,$vendor_id){
       global $WCFM, $WCFMmp,$wp;  
       if ($wp->query_vars['term_section'] || $wp->query_vars['s'] || get_query_var( $WCFMmp->wcfmmp_rewrite->store_endpoint('products') ) ) {
          return 'products';
        } else {
          return 'about';    
        }  
      },20,2);
      
      add_filter( 'wcfmmp_store_tabs', 'new_wcfmmp_store_tabs',90,2);
      function new_wcfmmp_store_tabs($store_tabs, $id) {  
         $new_store_tabs = array();
         $keyOrder = ['about','products','policies','followers','reviews'];
         foreach($keyOrder as $key) {
             $new_store_tabs[$key] = $store_tabs[$key];
         }    
         return array_filter($new_store_tabs);
      }
      
      add_filter( 'wcfmp_store_tabs_url', 'new_wcfmp_store_tabs_url',10,2);
      function new_wcfmp_store_tabs_url($store_tab_url, $tab) {
       switch( $tab ) {      
           case 'products':
             $store_tab_url = $store_tab_url.'products';
           break;      
         }
       return $store_tab_url;
      }
      
      add_action( 'wcfmmp_rewrite_rules_loaded', 'new_register_rule', 8 );
      function new_register_rule($wcfm_store_url) {
       global $WCFM, $WCFMmp;
       
       add_rewrite_rule( $wcfm_store_url.'/([^/]+)/'.$WCFMmp->wcfmmp_rewrite->store_endpoint('products').'?$', 'index.php?post_type=product&'.$wcfm_store_url.'=$matches[1]&'.$WCFMmp->wcfmmp_rewrite->store_endpoint('products').'=true', 'top' );
       add_rewrite_rule( $wcfm_store_url.'/([^/]+)/'.$WCFMmp->wcfmmp_rewrite->store_endpoint('products').'/page/?([0-9]{1,})/?$', 'index.php?post_type=product&'.$wcfm_store_url.'=$matches[1]&paged=$matches[2]&'.$WCFMmp->wcfmmp_rewrite->store_endpoint('products').'=true', 'top' );
      }
      
      function wcfm_vendor_profile_custom_endpoint() {
       global $WCFM, $WCFMmp,$WCFMu;
       add_rewrite_endpoint( 'products', EP_ROOT | EP_PAGES );
      }
      add_action( 'init', 'wcfm_vendor_profile_custom_endpoint' );

      Try 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/

      Thanks.

    • #112295
      Matt Flood
      Participant

      That worked like a charm!! Thank you!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.