A simple, powerful and independent e-commerce platform.
Sell anything with ease.

Change number of thumbnails per row in the product gallery

The product gallery thumbnails have a default setting of 4 per row but this may not work well with your theme. The number of thumbnails per row can be set using this code.

/*
 * Change number of thumbnails per row in the product gallery
 */
 
add_filter('woocommerce_single_product_image_gallery_classes', 'cc_columns_product_gallery');

function cc_columns_product_gallery( $wrapper_classes ) {

  $columns = 3; // change this to 2, 3, 5, etc. Default is 4.
  $wrapper_classes[2] = 'woocommerce-product-gallery--columns-' . absint( $columns );
  return $wrapper_classes;

}
View Raw Code ID: 965