Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search result link change
This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko 7 years, 5 months ago.
- AuthorPosts
- April 24, 2016 at 10:53 pm #8450
Dear Support
I have installed and configured my search. I am using Woo-commerce. I would like to change it so that every result when clicked adds that product to the cart (so it does not go to the product page no more).
This is my first time using premium plugin support, so hopefully this works out!
Thank you!
FrankApril 25, 2016 at 12:16 pm #8470Hi!
Can you please provide an URL to your website, where I can check your shop and the add to cart urls?
Best,
I need to see how it works on your installation in order to suggest a change or modification.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
April 25, 2016 at 1:37 pm #8474You cannot access this content.April 25, 2016 at 2:50 pm #8477Okays, 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.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
April 25, 2016 at 3:26 pm #8478Thanks worked perfectly!
April 25, 2016 at 3:38 pm #8479Great, I’m glad I could help you!
If you like the plugin, feel free to rate it on your codecanyon downloads page, it’s greatly appreciated.
I will close this thread and mark it as resolved now. If you have any other issues or questions, feel free to open another one.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.