I am trying to override the file woocommerce.php (themes/foodfarm/inc/functions/woocommerce.php) in child theme. But changes are not reflecting. Basically I want to change the product image url to directly add item in cart (on image click) rather than directing user to product detail page.
For that I need to change foodfarm_template_loop_product_thumbnail function.
I am trying to override the file woocommerce.php (themes/foodfarm/inc/functions/woocommerce.php) in child theme. But changes are not reflecting. Basically I want to change the product image url to directly add item in cart (on image click) rather than directing user to product detail page.
For that I need to change foodfarm_template_loop_product_thumbnail function.
But changes are not reflecting in child theme.
Kindly revert ASAP.
Hi,
You should follow the instruction below:
1. remove that function in functions.php file in child theme
2. Add new overriden function into this action
Thanks
Kind Regard.
I tried what you suggested.
It does not work.
URL: https://farmlandng.com/shop/
Here is the code..
Kindly revert.
<?php
// push your child theme functions here
remove_action( 'woocommerce_before_shop_loop_item_title', 'foodfarm_template_loop_product_thumbnail', 10 );
add_action( 'changethumburl', 'woocommerce_before_shop_loop_item_title', 20 );
function changethumburl(){
global $product;
?>
<a href="#">
<?php echo woocommerce_get_product_thumbnail(); ?>
</a>
<?php
}
Hi,
Sorry for not giving you details of the instruction.
You should write a function like this in functions.php in child theme. Try this.
Kind regard.