[Resolved] Open product image in a new tab

Home Forums Support [Resolved] Open product image in a new tab

Home Forums Support Open product image in a new tab

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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

    #698873
    Leo
    Staff
    Customer Support

    Hi 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 🙂

    #698893
    Zuzana

    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!
    Zuzana

    #698910
    Leo
    Staff
    Customer Support

    I’ve edited the code to remove lightbox as well.

    Let me know 🙂

    #699250
    Zuzana

    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?

    #699559
    Leo
    Staff
    Customer Support

    You’d have to ask WooCommerce for that part unfortuantely.

    It will likely require modifying their existing structure.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.