Sponsored Search Results

This topic contains 4 replies, has 2 voices, and was last updated by

3 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #17260


    I would like to ask if it’s possible to add a “sponsored” product on search results.

    Ex. – I have a promotional product that I want to show third on every search result with a tag “Promo” or as a new group if no search results are found.

    I would also like to know if it’s possible when there is a variable product to show its variation name on the search results.

    Thank you for your time.

    Best regards.



    Appending results between results is not really possible by configuration, but might be possible with a custom code.

    Sponsored post

    I have made a custom code that may work. I have tested it in few cases, but please be careful. Change the $id variable to the post ID you want to add as sponsored, and the $position variable to which position it should be.

    Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!

    Variation name
    As far as I know there is no such thing as variation name in WooCommerce. The product/variation titles are requested from WooCommerce itself, if it is filtered, it should return the vaues set in the database.
    Is this perhaps a custom field that is set separately, or another feature, let me know, I can take a look at it.

    Ernest Marcinko

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


    Unfortunately the code above did not work. I implemented it, cleared cache but the requested post did not show. I am not aware if it matters but I am using “Grouping” for the results and that may cause the issue.

    Variation name
    I not an expert in coding but I found a snippet below that can be used to extract the variation slug name in Woocommerce 3.0+ and might help you.

    Either way thank you so much for your time and effort.



    The grouping is definitely an issue, I don’t think it is possible with that feature enabled.

    Variation Name
    Thank you for that code. From what I can see, he is trying to add a specific product attribute to the variation title. He was using a different code, but that won’t work with the current WooCommerce version.
    What I don’t understand is, what the variation title should be? Do you want to display product variation attributes within the product title?

    Ernest Marcinko

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


    I apologize for the confusion since I don’t really know the correct term for the variation name.

    I was referring to the names in the red box in the attached photo.
    I would like these names to appear either next to the product title or as a different line below the title, when a variation is shown as a search result.

    Ex. To display variation SKUs on the search results we use _sku

    You must be logged in to view attached files.
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.