NextGen IT

Show add to cart button on woocommerce category page for variable product and group product

Show add to cart button on woocommerce category page for variable product and group product

Open Woocommerce plugin folder > find > templates/content-product.php

If you using advanced theme or if you want to hook woocommerce in your theme, just make a folder named woocommerce under your parent or child theme folder. copy that file from woocommerce plugin > templates/content-product.php

Now add this file to theme > Woocommerce folder.

Now change this code

<?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’ );
?>

<?php do_action( ‘woocommerce_after_shop_loop_item’ ); ?>

Replace with

<?php
/**
* ADD PRODUCT VARIABLE WITH ADD TO CART ON CATALOG PAGE ADDED BY IMRAN 
**/
?>

<?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’ );
?>

<?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();
}

?>

0 Responses on Show add to cart button on woocommerce category page for variable product and group product"

Leave a Message

Nextgen BD © 2017 . All rights reserved. Designed & Developed by SKILL TOUCH IT.