Site logo

Archived topic

The videos in the product categories open only for a few seconds and then forwar

14 replies · Started by Ceramica Sud Curlante on July 9, 2021

Viewing posts 1–15 of 15

Hi, I created an e-commerce video. I have inserted videos with function LAZY LOAD in the short description, when I click on the video in the product category or home page, the video opens for a few seconds and forwards me directly to the product without showing me the video.

The product (except button) elements are inside "a" tag (inside clickable link). If you click anywhere on product (except space around button), it is a link into product page. This is default WooCommerce layout - see default WooCommerce theme - https://themes.woocommerce.com/storefront/

You can switch the theme to default WooCommerce - Storefront - https://wordpress.org/themes/storefront/ and see the result.

Problem is in the plugin, that "inject" code inside "a" tag link. This is not correct. They must do it outside.

Hi there,

Just to confirm, are you saying that this issue only occurs with GP Premium activated?

That's right, I'd like to figure out how to fix the bug.
try to click on any of the videos on the home page of my site and you will understand.
The video opens for a few seconds and then I am directed to the article page.
Thank you very much for your attention.
Let me know if it is possible to solve my problem.

Gmm I can't see how GP or GP Premium can cause an issue like this as that is a template from WooCommerce itself.

Can you disable GP Premium first?

Also, the page you linked in the private info section isn't using GeneratePress as the theme.

Even setting your theme the problem persists.

I wanted to know how to fix and what caused the error.

Hi there,

thats the default template for woocommerce that wraps the entire content in template product link.
Try adding this PHP Snippet to close the link just after the image:

remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 15 );

The code has solved the problem, but I find that the title of the product is not clickable, only the photo of the product is clickable.

Remove that PHP Snippet and try this instead:

remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 ); 
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_link_open', 9 );
add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 11 ); 

Bravissimo David .... THANKS REALLY, IT WORKS :-) :-) :-)

Awesome - glad to hear that!

Hi David, is it possible to have both the photo and the title clickable? thank you very much

Not sure - give this a try instead.

remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 ); 
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_open', 9 );
add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 11 ); 

- THANKS REALLY, IT WORKS 🙂 🙂 🙂

- The site turned out great!!!

Awesome - glad to hear that!!

This archived topic is closed to new replies.