I’m trying to link products on my Woocommerce shop page directly to the external/affiliate site by clicking on the product’s image.
I created a child theme of my current theme and am working in a child’s version of the Woocommerce “content-product.php” file.
Found a few similar topics, but my content-product.php file looks differently, so that’s where I got lost.
Can anyone see where I should add/change what exactly to have the product images redirect directly to the external site?
For some reason I couldn’t paste the code in here nicely but the full one can be viewed at http://lifestylespot.nl/code.txt
I figured (according to info found elsewhere) that the following would do the trick:
Replacing:
global $product;
by
global $product;
if(!is_single()) $product_url = get_post_meta( $product->id, '_product_url', true );
if(empty($product_url)) $product_url = get_permalink();
![enter image description here][1]?>
That did the trick. But it made my shop page look like: http://i.stack.imgur.com/uu3a7.png
Thanks in advance!
I got it working.
Simply changed:
to:
And to open the affiliate link in a new window: