[Resolved] Niche theme – Woocommerce : show categories in wc pages

Home Forums Support Niche theme – Woocommerce : show categories in wc pages

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1365463
    Claudia

    Hi Tom, David and Leo (I don’t know if I’m missing someone)

    First of all, we really appreciate the work you are doing with GP 🙂

    To the point, I’ve tried to find the solution in the forum, but I couldnt. We are running Niche theme, and we’ld like to show the woocommerce product categories in shop pages (shop index, single product, and I any other wc page)

    I’ve checked and we have the “Woocommerce Shop Category Menu” Element enabled (see below). As far as I checked the code is not generated in the html. I don’t know what we are doing wrong. Can you help us? Or any idea how to proceed?
    Thank you in advance

    <?php
    $cat_args = array(
    	'orderby'    => 'name',
    	'order'      => 'asc',
    	'hide_empty' => false,
    );
     
    $product_categories = get_terms( 'product_cat', $cat_args );
    
    if ( ! empty( $product_categories ) ) {
    	echo '<ul class="woo-cat-nav">';
    		foreach ( $product_categories as $key => $category ) {
    			printf( 
    				'<li>
    					<a href="%1$s">
    						%2$s
    					</a>
    				</li>',
    				get_term_link( $category ),
    				$category->name
    			);
    		}
    	echo '</ul>';
    }
    

    ?>

    Hook woocommerce_archive_description
    Execute PHP YES
    Display Rules

    • Product Category Archive: All Product Categories
    • Product Archive
    #1365523
    David
    Staff
    Customer Support

    Hi there,

    Lets test if the hook is where it should be.
    In your hook code above, just before the <?php add:

    <h2>The hook is working</h2>

    If that displays on the front end we know the hook is working. Let me know. Then we can look at why the codes conditions aren’t being met

    #1365553
    Claudia

    Hi David,
    Nope, it doesn’t display it

    #1365587
    David
    Staff
    Customer Support

    That means that either:

    1. The Display Rules are not working.
    OR
    2. The Hook is missing.

    Lets test #1 – by adding Entire Site to the Hooks Display Rules.

    Let me know.

    #1365591
    Claudia

    Ok, adding to display for the entire site didn’t work

    #1365747
    David
    Staff
    Customer Support

    Now try changing the hook to after_header
    Keep the Display Rules as is.
    And keep the <h2>The hook is working</h2> in there.

    #1365853
    Claudia

    Ok, I’ve got something 🙂
    Changing the hook to after_header make it appear in the single product page. Not in the shop page. Even more, it appeared all the categories. You can check by yourself in the provided link

    #1365862
    David
    Staff
    Customer Support

    OK – something else must be interfering.
    Are you using a Child Theme ? If so can you temporarily disable it.

    Next step is to disable any other plugins or custom functions to see if there is a conflict.

    #1365951
    Claudia

    SOLVED!
    It was the plugin “Productos sin stock” (that orders the WC products with no stock at last position)
    Thank you David!

    #1366442
    David
    Staff
    Customer Support

    Glad to hear you found the issue.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.