Reading // Return the number of products you wanna show per page. $online_shop_customizer_all_values = online_shop_get_theme_options(); $online_shop_wc_product_total_number = $online_shop_customizer_all_values['online-shop-wc-shop-archive-total-product']; if ($online_shop_wc_product_total_number) { $cols = $online_shop_wc_product_total_number; } return $cols; } add_filter( 'online_shop_filter_products_per_page', 'online_shop_loop_shop_per_page', 20 ); /*Related https://docs.woocommerce.com/document/change-number-of-related-products-output/*/ function online_shop_related_products_args( $args ) { $number= online_shop_loop_columns(); $args['posts_per_page'] = $number; // 4 related products $args['columns'] = $number; // arranged in 2 columns return $args; } add_filter( 'woocommerce_output_related_products_args', 'online_shop_related_products_args' ); /*https://gist.github.com/mikejolley/2044109*/ add_filter( 'woocommerce_add_to_cart_fragments', 'online_shop_header_add_to_cart_fragment' ); function online_shop_header_add_to_cart_fragment( $fragments ) { global $woocommerce; ob_start(); ?> cart->get_cart_contents_count() );?>