• Resolved Gokhan

    (@snowman_tr)


    Hi there, I am having some issues. I used to use a code within functions.php (before I updated my theme) and it was preventing shoppers to go to single product page. So when they click on a product (on the product listing page) they used to go to amazon product page directly with my affiliate id. It doesn’t work anymore and I don’t remember what the code or setup I used to use.

    Can someone please help me?

    • This topic was modified 4 years, 5 months ago by Gokhan.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Gokhan

    (@snowman_tr)

    I found the solution myself ?? if someone need this in the future please add this code in to your functions.php:

    function woocommerce_template_loop_product_link_open() {
        global $product;
    
        if( $product->is_type( 'external' ) ) {
            $link = apply_filters( 'woocommerce_loop_product_link', $product->get_product_url(), $product );
            echo '<a target="_blank" href="' . esc_url( $link ) . '" rel="noopener noreferrer">';
        } else {
            $link = apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product );
            echo '<a href="' . esc_url( $link ) . '">';
        }
    }
    • This reply was modified 4 years, 5 months ago by Gokhan.
    Plugin Support wpnomad a11n

    (@wpnomad)

    Hi @snowman_tr ,

    Thank you for sharing the solution ??

    I’ll mark this thread as resolved now, if you need any other WooCommerce help, feel free to open a new thread.

    Thread Starter Gokhan

    (@snowman_tr)

    Thanks buddy ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable single product pages BUT send users directly from the shop page to amzon’ is closed to new replies.