-
purevelvetdesign
Hi,
here I have the case that the product categories of WooCommerce float into product columns.
Is there a fix for that?Thanks
André -
Hi there,
To separate the woocommerece categories from the products on the shop page requires some PHP.
Woo hooks in thewoocommerce_maybe_show_product_subcategories
function to the product loop.
Which you can unhook from loop and then re-hook before the loop, using this snippet:// remove the subcategories from the product loop remove_filter( 'woocommerce_product_loop_start', 'woocommerce_maybe_show_product_subcategories' ); // add subcategories before the product loop add_action( 'woocommerce_before_shop_loop', 'show_product_subcategories', 10 ); function show_product_subcategories() { $subcategories = woocommerce_maybe_show_product_subcategories(); if ($subcategories) { echo '<ul class="subcategories products columns-4">',$subcategories,'</ul>'; } }
Note this line:
echo '<ul class="subcategories products columns-4">',$subcategories,'</ul>';
The
columns-4
defines the number of columns being display for the categories. Change the4
to whatever you require.
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.