woocommerce hook for featured images on shop / category pages
-
We are using a woocommerce plugin for featured videos instead of featured images. These are’nt showing and the plugin authors are saying for the shop page, theycouldn’t find any hook for the images. This is a theme compatibility issue. Your theme is not using a hook for images. The hook we should be using is woocommerce_product_get_image. Can you help us with this or provide a workaround?
Hi,
Try to add the following PHP code snippet to the child theme functions.php file to fix this
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'basel_template_loop_product_thumbnail', 10 );
Regards
thanks, doing that didn’t change anything but when we changed to number from 10 to 999 it displayed a duplicate of images so that got the video showing but wouldn’t remove the basel images. Any ideas? can i change the numbers on the actions?
Attachments:
You must be
logged in to view attached files.
Please, send us your admin and FTP access and switch to default theme temporarily so we can see how the plugin should work.
we have created staging environtment – https://staging1.rockefellers.co.uk/ so you can do what you want. login details below
Please, switch to the default theme and send us a product example where we can see how it should work.
https://staging1.rockefellers.co.uk/shop/ visit this page and you will see the product featured image is blank when it should show preview of the vimeo video like it does on the actual product page
Try to replace the code with the following one
add_action('init', function() {
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'basel_template_loop_product_thumbnail', 10 );
}, 1000);
thanks but that doesnt work either. it’s supposed to open up a lightbox with the video on. also when hovering over the product thumbnail it shows the empty image placeholder.
If you check the staging site now i have switched to storefront theme you will see how it should work – https://staging1.rockefellers.co.uk/shop/
the live site doesn’t reflect this – https://rockefellers.co.uk/product-category/diamonds/
As for the lightbox, it is a separate issue and you need to contact plugin’s support for help.
The hover image function can be disabled in Theme Settings -> Shop.
thanks it;s working now 🙂
The topic ‘woocommerce hook for featured images on shop / category pages’ is closed to new replies.