Hello,
In my product page, I would like to custom the clic on my image product.
This reply has been marked as private.
hi
for that, you can search this
woocommerce product image external URL
you will get many links to follow
I have found something:
https://wordpress.org/support/topic/external-url-on-product-images/
https://www.businessbloomer.com/woocommerce-edit-external-product-image-url/
I cannot find something is working. The link here is old (2016 or 2018) with old version of woocomerce.
I think this is maybe good but how I can make it work for my product ? =>
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;
}
}
Thank you for your help.
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( 'your custom url here' );
exit;
}
}
add this code
This reply has been marked as private.
yes no need to specify any product details
add the code in wplms0costomizer.php in wplms-customizer plugin
hello,
Sorry i did not see your awnser. I have for exemple 4 product : 23678, 27890, 2145, 4567.
How i can do that ?
Thank you ?
hi
means you want to redirect these products
I have for exemple 4 product : 23678, 27890, 2145, 4567.
to that specific page right?
if yes then the above code will work