- This topic has 5 replies, 2 voices, and was last updated 3 years, 7 months ago by
Leo.
-
AuthorPosts
-
October 11, 2018 at 2:58 am #698556
Zuzana
Hello!
I am searching for a code which will help me to do the following for the Woocommerce single product image:
– remove the default zoom and lightbox from the picture
– open the whole image in a new tab instead, when the user clicks on the image(The reason behind this is that the image actually represents text and with the default zoom option in the lightbox, the picture became too huge to be comfortable to read and moreover the only way to move down the image while in zoom was using drag and drop option, scrolling didn’t work. So please, if there is another way how to solve this, I will be more than happy.)
I already tried to read some topics such as https://wordpress.org/support/topic/disable-lightbox-for-woocommerce-products/ but it didn´t really solve my problem.
You can check the website here: https://interweld.sk/produkty/zvaracie-elektrody/zvaracie-elektrody-nizko-a-stredne-legovane/iw-e-210/
I am really thankful for any help and for your time!
Zuzana
GeneratePress 2.1.4GP Premium 1.7.2October 11, 2018 at 9:30 am #698873Leo
StaffCustomer SupportHi there,
Try this PHP snippet:
add_action( 'wp', 'tu_remove_wc_zoom', 20 ); function tu_remove_wc_zoom() { remove_theme_support( 'wc-product-gallery-zoom' ); remove_theme_support( 'wc-product-gallery-lightbox' ); }
Adding PHP: https://docs.generatepress.com/article/adding-php/
It should solve both problems.
Let me know 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 11, 2018 at 10:00 am #698893Zuzana
Hello Leo,
I placed the code to the website using Code Snippets plugin, but it didn’t solve the problem. When the user clicks on the image, lightbox still appears. I would need that after clicking on the image, the image will be opened as regular URL in the new tab of the browser.
Thank you very much!
ZuzanaOctober 11, 2018 at 10:31 am #698910Leo
StaffCustomer SupportI’ve edited the code to remove lightbox as well.
Let me know 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 12, 2018 at 1:55 am #699250Zuzana
Now the lightbox disappeared, that is good. But is it possible that the picture is now opening in the new tab of the browser and not in the same one?
October 12, 2018 at 8:33 am #699559Leo
StaffCustomer SupportYou’d have to ask WooCommerce for that part unfortuantely.
It will likely require modifying their existing structure.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.