Add code to your child theme’s functions.php
file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php
file as this will be wiped entirely when you update the theme.
Defines where ‘first’ and ‘last’ classes are applied in product archives.
Please be aware that some third-party themes may be coded in a way that the snippets below have no effect on layout. In this case, we recommend you contact the theme author.
Custom theme
If you’re building a theme it may be useful to make this pluggable for other developers. When included in your theme, other developers will be able to customize this function.
https://gist.github.com/woogists/11472c1f1b4982a83a4f7987d73575ed
Theme by Woo
If you’re using a WooTheme then this code may have been utilized in the theme. It will already be pluggable which means you’ll need to redefine the function in your functions.php
file (preferably in a child theme) to overwrite the theme default.
https://gist.github.com/woogists/3894598a086c4e265facc16fed0b9c10
Shortcode
Use the WooCommerce shortcodes on your archive page.
[recent_products per_page="12" columns="5"]
will display the products in rows of 5 columns.
Plugin
Alternatively, you may want to try the WooCommerce Product Archive Customizer plugin, which includes an option to change the number of products displayed per row and more.