Woocommerce – Product variations on category page with add-to-cart SOLUTION
-
I’d been looking for a solution to this for a long time and never quite found anything that worked…until today.
This is my setup:
WC Version: 2.1.6
WC Database Version: 2.1.6
WP Version: 3.8.1
WP Multisite Enabled: No
Web Server Info: Apache
PHP Version: 5.3.27
MySQL Version: 5.1.39-log
———————————Here’s the solution:
Go to plugins > woocommerce > templates > content-product.php
First, make a back-up of content-product.php. This is the file you’ll be editing and if something goes wrong, you’ll be glad you have this.
Search for <h3><?php the_title(); ?></h3>
Add this snippet right after the </h3>
<?php //ADD SHORT DESCRIPTION TO PRODUCT add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5); ?> <?php /** * woocommerce_after_shop_loop_item_title hook * * @hooked woocommerce_template_loop_rating - 5 * @hooked woocommerce_template_loop_price - 10 */ do_action( 'woocommerce_after_shop_loop_item_title' ); ?> </a> <?php do_action( 'woocommerce_after_shop_loop_item' ); ?> <?php //ADD VARIATIONS BEFORE ADD TO CART if($product->product_type == "variable"){ woocommerce_variable_add_to_cart(); } else { woocommerce_template_loop_add_to_cart(); } ?>
- The topic ‘Woocommerce – Product variations on category page with add-to-cart SOLUTION’ is closed to new replies.