Tagged: related products, woocommerce
Hi All,
Does anybody know how to increase the amount of related products with enfold?
I have tried the woocommerce function but without success, I dont want to edit the core files so updates will stay easy and safe.
/**
* WooCommerce Extra Feature
* --------------------------
*
* Change number of related products on product page
* Set your own value for 'posts_per_page'
*
*/
function woo_related_products_limit() {
global $product;
$args['posts_per_page'] = 99;
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' );
function jk_related_products_args( $args ) {
$args['posts_per_page'] = 99; // 99 related products
$args['columns'] = 4; // arranged in 4 columns
return $args;
}
Searched this forum but all requests seem to be to either increase column count or disable/hide related products.
A working childtheme function would be awesome!
thx,
Thomas
Hi borkent!
Please try to insert this code into the child theme functions.php file:
function avia_chance_wc_related_columns(){
global $avia_config;
$avia_config['shop_single_column'] = 4; // columns for related products and upsells
$avia_config['shop_single_column_items'] = 4; // number of items for related products and upsells
}
add_action('wp_head', 'avia_chance_wc_related_columns', 10);
and replace 4 with any custom, positive value.
Cheers!
Peter
thx for being awesome!
Any idea on sorting these products, they are random now…
just to let you know, the related products can be sorted with the plugin “post types order”
This isnt really the correct way of doing it, but it works!
Somehow the post types order plugin disabled the random sort and shows em in the order configured :)
all good for me, have a great weekend!