• VickyTFC

    (@vickytfc)


    Hi there

    Is there a way to have the following code for my product images/thumbnails link to a new tab?

    add_action( ‘template_redirect’, ‘redirect_external_products’ );
    function redirect_external_products() {
    global $post;
    if ( is_singular( ‘product’ ) && ! empty( $post ) && ( $product = wc_get_product( $post ) ) && $product->is_type( ‘external’ ) ) {
    wp_redirect( $product->get_product_url() );
    exit;

    Any help is much appreciated.

    Thanks, Vicky

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Product Image Thumbnail to External Link in New Tab’ is closed to new replies.