Remove single product pages
-
Hello! I have an online shop with only affiliate products. Every product is redirected to the original website.
This is an example of a category page: https://cesaicumpar.ro/categorie/idei-cadouri-femei/cadouri-mama/
How can I make the product preview title and image send the client directly on the affiliate website, without entering the single product page? Right now only the blue button does this (Cumpără acum)
I would like the link to be opened in a new tab
Hello,
Sorry but there is no option in Theme Settings available for that.
It requires customizations and this is beyond our limitations and support policy.
Best Regards
I have managed to find the code on another forum. It works fine, but it doesn’t open in another 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;
}
}
Could you at least help me open it in another tab? It doesn’t seem that hard, but I have 0 experience in this kind of stuff
Hello,
Sorry but we could not help you with third party code snippets this is out of our theme support scope.
Best Regards