Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author WC Lovers

    (@wclovers)

    You may show this using this hook –

    do_action( 'wcfmmp_store_list_after_store_info', $store_id, $store_info );

    Thread Starter Anonymous User 18302653

    (@anonymized-18302653)

    thanks for your response, but this doesnt work. I have implemented this code in the functions.php file.

    Do you have another solution?

    Plugin Author WC Lovers

    (@wclovers)

    What code have you implemented using this hook, show me screenshot please.

    Thread Starter Anonymous User 18302653

    (@anonymized-18302653)

    Sorry but I do not know what you exactly mean. I took the code which you gave me and put this in the functions.php file.

    Unforntunately I don’t know who to send you a screenshot via wordpress support.

    Thread Starter Anonymous User 18302653

    (@anonymized-18302653)

    Addition: the functions.php file is the one in my child theme.

    Plugin Author WC Lovers

    (@wclovers)

    I had provided you only hook, which you can use to show that information.

    Can you write that code yourself or should I write for you?

    Thread Starter Anonymous User 18302653

    (@anonymized-18302653)

    Ok, I see. Unfortunately my php skills arent that good. Could you write the code for me?

    Thanks in advance.

    Plugin Author WC Lovers

    (@wclovers)

    OK, I will write this code for you.

    But, how many categories will show there. Suppose a store associated with 50 categories but it’s not possible to show all over there!

    Thread Starter Anonymous User 18302653

    (@anonymized-18302653)

    Thats great, thank you very much!

    We only have 5 possible categories on our homepage to select, so it would be enough to display only those 5.

    Plugin Author WC Lovers

    (@wclovers)

    Use this snippet –

    add_action( 'wcfmmp_store_list_after_store_info', function( $store_id, $store_info ) {
    	$store_user = wcfmmp_get_store( $store_id );	
    	$vendor_categories = $store_user->get_store_taxonomies();
    	$preferred_taxonomy = 'product_cat';
    	$url_base           = 'tax-'.$preferred_taxonomy;
    	$display_vendor_term = array();
    	$vendor_categories_html = '';
    	if( !empty( $vendor_categories ) ) {
    		foreach( $vendor_categories as $vendor_category_id => $vendor_category ) {
    			if( $vendor_category_id ) {
    				if( !apply_filters( 'wcfm_is_allow_vendor_store_taxomony_by_id', true, $vendor_category_id, $store_user->get_id(), $preferred_taxonomy ) ) continue;
    				if( is_array( $vendor_category ) && !empty( $vendor_category ) ) {
    					$vendor_term = get_term( absint( $vendor_category_id ), $preferred_taxonomy ); 
    					if( $vendor_term && $vendor_term->term_id && $vendor_term->name ) {
    						$vendor_categories_html .= '<a style="color:#fff;" href="' . $store_user->get_shop_url() . $url_base . '/' . $vendor_term->slug . '/#tab_links_area">' . $vendor_term->name . '</a>';
    					}
    					foreach( $vendor_category as $vendor_category_child_id => $vendor_category_child ) {
    						if( !apply_filters( 'wcfm_is_allow_vendor_store_taxomony_by_id', true, $vendor_category_child_id, $store_user->get_id(), $preferred_taxonomy ) ) continue;
    						$vendor_term = get_term( absint( $vendor_category_child_id ), $preferred_taxonomy );
    						if( !is_array( $vendor_category_child ) ) {
    							if( $vendor_term && $vendor_term->term_id && $vendor_term->name ) {
    								if( in_array( $vendor_term->term_id, $display_vendor_term) ) continue;
    								$display_vendor_term[$vendor_term->term_id] = $vendor_term->term_id;
    								$vendor_categories_html .= ', <a style="color:#fff;" href="' . $store_user->get_shop_url() . $url_base . '/' . $vendor_term->slug . '/#tab_links_area">' . $vendor_term->name . '</a>';
    							}
    						} else {
    							$vendor_categories_html .= ', <a style="color:#fff;" href="' . $store_user->get_shop_url() . $url_base . '/' . $vendor_term->slug . '/#tab_links_area">' . $vendor_term->name . '</a>';
    						}
    					}
    				} else {
    					$vendor_term = get_term( absint( $vendor_category_id ), $preferred_taxonomy ); 
    					if( $vendor_term && $vendor_term->term_id && $vendor_term->name ) {
    						if( in_array( $vendor_term->term_id, $display_vendor_term) ) continue;
    						$display_vendor_term[$vendor_term->term_id] = $vendor_term->term_id;
    						$vendor_categories_html .= '<a style="color:#fff;" href="' . $store_user->get_shop_url() . $url_base . '/' . $vendor_term->slug . '/">' . $vendor_term->name . '</a>';
    					}
    				}
    			}
    		}
    	}
    	echo $vendor_categories_html;
    }, 50,  2 );

    Add custom code(s) to your child theme’s functions.php
    In case you do not have child theme then add those using this plugin –?https://www.ads-software.com/plugins/code-snippets/

    Thread Starter Anonymous User 18302653

    (@anonymized-18302653)

    It works. Thank you very much for your help!

    Plugin Author WC Lovers

    (@wclovers)

    Glad to know ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Display Vendor Category in Store List’ is closed to new replies.