Site logo

Archived topic

Display secondary image on hover feature

3 replies · Started by Manja on April 12, 2023

Viewing posts 1–4 of 4

In the shop archive when hovering over a product the second product image appears. Since it is not provided natively by WooCommerce, I think this feature comes directly from GeneratePress. Now I want to show more products on the home page with a WooCommerce block (handpicked products) and for consistency it would be great if it behaves the same way as the shop archive products. However, I can't find the code in the theme files. Can you please give me a hint where it is?

Hi there,

the second image is added by GP Premium Plugin:.

gp-premium/woocommerce/functions/functions.php

the function name is :generatepress_wc_secondary_product_image and starts at line 1237.

But it is a PHP Function, that hooks into the Woo templates, and their Blocks don't use those templates and they have those hooks ( if any ).

NOTE: The Woo Shortcodes work exactly like the woo templates, so those will do this and respect the same styles automatically.

Oh GP Premium Plugin makes sense of course! I thought seeing the code would give me an idea of how to get it into the block. But your suggestion with the woo shortcode is actually a lot more time saving! Thanks a million. Didn't see the forest for the trees.

Glad to be of help :)

This archived topic is closed to new replies.