• msmcmullen

    (@msmcmullen)


    In my WooCommerce store I have some external products and I use the product URL in product lists instead of the permalink because I can point the product URL to any valid URL and not to the product page.

    <a href="<?php echo esc_url( $product->get_product_url() ) ?>" target="_blank"><?php the_title(); ?></a>

    I’d like to do the same on search result pages, but replacing the permalink with the above code prevents the search results from displaying.

    https://www.ads-software.com/plugins/relevanssi/

Viewing 1 replies (of 1 total)
  • Plugin Author Mikko Saari

    (@msaari)

    This has nothing to do with Relevanssi.

    Anyway, $product is likely not defined on the search results loop, the post object is in $post. You need to figure out how to get the $product object active on the search results template. That’s a WooCommerce thing, so I don’t know how that works.

Viewing 1 replies (of 1 total)
  • The topic ‘Trouble using get_product_url in search results’ is closed to new replies.