Support » Plugin: WooCommerce Products Per Page » Not working with theme

  • elipsis9


    Hi, I just downloaded your plugin, thanks for creating it. I activated it and changed the shop columns. I nedd them to be 4 (or at least 3) but my products keep showing up in a weird 2/1 column layout. I Think there must be a conflict with the theme I´m using.

    Here´s the related code on the theme content.php file, if you could have a look I´d really appreciate any suggestions, thanks!

    // Change number of products per page
    add_filter(‘loop_shop_per_page’, ‘tpath_woo_loop_shop_per_page’);

    function tpath_woo_loop_shop_per_page() {
    global $tpath_options;

    parse_str($_SERVER[‘QUERY_STRING’], $params);

    if( isset( $tpath_options[‘tpath_loop_products_per_page’] ) && $tpath_options[‘tpath_loop_products_per_page’] != ” ) {
    $products_per_page = $tpath_options[‘tpath_loop_products_per_page’];
    } else {
    $products_per_page = 12;

    $product_count = !empty($params[‘product_count’]) ? $params[‘product_count’] : $products_per_page;

    return $product_count;

    // Change number of products per row to 4
    add_filter(‘loop_shop_columns’, ‘tpath_woo_loop_columns’);

    function tpath_woo_loop_columns() {

    global $tpath_options;

    if( isset( $tpath_options[‘tpath_loop_shop_columns’] ) && $tpath_options[‘tpath_loop_shop_columns’] != ” ) {
    $product_columns = $tpath_options[‘tpath_loop_shop_columns’];
    } else {
    $product_columns = 3;

    return $product_columns;

    // Related Products Count
    remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_related_products’, 20 );
    add_action(‘woocommerce_after_single_product_summary’, ‘tpath_woocommerce_output_related_products’, 15);

    function tpath_woocommerce_output_related_products() {
    global $tpath_options;

    if( isset( $tpath_options[‘tpath_related_products_count’] ) && $tpath_options[‘tpath_related_products_count’] != ” ) {
    $related_count = $tpath_options[‘tpath_related_products_count’];
    } else {
    $related_count = 3;

    $args = array(
    ‘posts_per_page’ => $related_count,
    ‘columns’ => $related_count,
    ‘orderby’ => ‘rand’

    woocommerce_related_products( apply_filters( ‘woocommerce_output_related_products_args’, $args ) );

Viewing 1 replies (of 1 total)
  • Plugin Author Jeroen Sormani



    I didn’t go through all that code to figure out what it does, but if needed it is possible to remove those hooks to ensure those functions are not applied. (use the remove_action and remove_filter functions)
    From a quick glance it appears that there should be options in the theme for the columns though.

    It could also very well be that a theme does not support a specific number of columns with their styling; 3 usually is supported, but I of course can’t speak for a theme I didn’t create.

    You could also try and send a message to your web/theme developer to see if changing those numbers is possible. Unfortunately I can’t support creating custom code for just any specific theme.

    Hope that helps at least a bit!

    Have a great day!
    Jeroen Sormani

Viewing 1 replies (of 1 total)
  • The topic ‘Not working with theme’ is closed to new replies.