/* * 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; }