This topic has 10 replies, 2 voices, and was last updated 4 months ago ago by Luca Rossi
Hi there,
I have a custom code that need to be added to the woocommerce_after_shop_loop_item hook, but it doesnt show on the front-end. please advise.
thanks
Hi @Anas,
Please try adding this custom codes under functions.php file locates in your child theme:
add_action('woocommerce_after_template_part', 'n2t_woocommerce_after_shop_loop_item');
function n2t_woocommerce_after_shop_loop_item($template_name){
if($template_name == 'loop/loop-end.php') {
echo 'Your custom code';
}
}
Hope it helps!
Hi there, i have added this to the child theme functions but the custom snippet doesn’t show on the shop or archive pages. Please advise, i have provided the login
Dear Anas,
We hope this message finds you well.
We would like to inform you that the custom codes appear to be functioning correctly. We suspect that the issue may be related to the cache.
For your reference, we have attached a screenshot that illustrates the current status.
Thank you for your attention to this matter.
Best Regards,
8Theme’s Team
Hey luka,
Noted, it is shown only for the first product on the last row of each archive page but why it is not showing for the other products? I need this to be shown on all products. I have cleared cache and checked, same issue. Please clarify. Treat this as top urgent
thanks for your support,
Hi @Anas,
If you want to add the custom code for each product, please try with this code instead:
add_filter('after_etheme_product_grid_list_product_element_title', 'n2t_after_etheme_product_grid_list_product_element_title');
function n2t_after_etheme_product_grid_list_product_element_title(){
echo 'Your custom code';
}
Best Regards,
8Theme’s Team
Great, this works but i need to show it after and below the price, any advise? thanks
Hi @Anas,
Please update the previous code to this:
add_filter('after_etheme_product_grid_list_product_element_title', 'n2t_after_etheme_product_grid_list_product_element_title');
function n2t_after_etheme_product_grid_list_product_element_title(){
echo '<div class="custom-code">Your custom code</div>';
}
After that, add this custom CSS codes under XStore > Theme Options > Theme Custom CSS > Global CSS:
.etheme-product-grid-content {
display: flex;
flex-direction: column;
}
.etheme-product-grid-content .custom-code {
order: 10;
}
Should you require further customizations, we offer specialized services which can be accessed here: https://www.8theme.com/account/#etheme_customization_panel.
Thank you for your understanding and cooperation.
Best Regards,
The 8Theme Team
Great, thank you for the quick support and quick replies. your support keep our projects going smoothly according to our timeline.
much appreciated Luca
If you need anything else please let us know.
Best Regards,
The 8Theme Team
The issue related to '‘Add custom shop loop for the “woocommerce_after_shop_loop_item” hook on elementor product archive’' has been successfully resolved, and the topic is now closed for further responses