Reply To: Search result link change

Ernest Marcinko
Ernest Marcinko

Okays, I think I have a solution for you.

Put this code to the functions.php file in your active theme directory:

add_filter( 'asp_results', 'asp_links_to_addtocart', 1, 1 );
function asp_links_to_addtocart( $results ) {
  foreach ($results as $k=>$r) {
    // Modify the URL
    $results[$k]->link  = "/?add-to-cart=".$r->id."&quantity=1";
  return $results;

That will change the results URLs to the add to cart WooCommerce URLs.

Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)