Skip Navigation

[Gelöst] Output Review form based on Product Dropdown

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 14 Antworten, has 3 Stimmen.

Last updated by Beda vor 2 Jahre, 6 Monate.

Assigned support staff: Beda.


Tell us what you are trying to do?
I want to create a page in which a customer can select any product from a dropdown and once selected it will display the following [wpv-post-title][wpv-woo-single-products-rating][wpv-woo-reviews] based on the product selected from dropdown.

Is there any documentation that you are following?

Is there a similar example that we can see?
Not sure



Languages: Englisch (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Paul,

Thank you for contacting our support forum.

You aren't able to have a dropdown list with the post title, you can filter posts by their various custom fields and taxonomy but not by the title in a dropdown.

The only way to filter the title is with the use of a custom search box.

So perhaps you can filter the posts by one of its attributes and still display the same data that you want to.




Okay, so I created a taxonomy for Color which represents the product title exactly.

I set up a view content selection: products

search and pagination:

[wpv-filter-start hide="false"]
<div class="form-group">
<label>[wpml-string context="wpv-views"]Product Color[/wpml-string]</label>
[wpv-control-post-taxonomy taxonomy="pa_color" type="select" url_param="wpv-pa_color"]


<!-- wpv-loop-start -->
<!-- wpv-loop-end -->
[wpml-string context="wpv-views"]No items found[/wpml-string]

But it isn't working. Please, can you check?

hidden link



Languages: Englisch (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Paul,

So the product title does work.

[wpv-woo-single-products-rating] This shortcode will work on your view, but based on our documentation this one won't [wpv-woo-reviews]

The [wpv-woo-reviews] is meant to be used on a single product template.

Also do any of these products have ratings that you are displaying ?



Hi Shane,

This is what I am trying to do.

Product dropdown to show review form based on selection.

Is it possible to do this and if so how?

For example, if someone selected Color: Aquila I want to show the review form for that product.



Languages: Englisch (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Paul,

Thank you for the clarity.

In this case no this is not possible, since the reviews form is in this shortcode

And this shortcode only works on the single product pages, you will need to write some custom code in order to get the form to be in your view.

An alternative is that you can list the products and have the users click to the single product where they can post the review there.



Hello Shane,

Can anyone in your team help me with the custom code? Can you give me some more insight, I know a bit of PHP so maybe I can piece it together.

This would also be a great addition to your software and documentation.

We are trying to build a page that we can send specific users to leave a review using a dropdown and not the other way.



Languages: Englisch (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Paul,

Actually we don't offer custom coding services, but what we do offer is that we have a list of contractors who can provide this service for you.

It's mainly because this will require the use of the woocommerce api in order to load the form here in views.

What I suggest doing is to contact one of our registered contractors for advice on how to implement this one.



I dont think that I need a contractor. I dont think we need to access the API for this.

I think all we need it just a bit more knowledge about how to create the dropdown and display the product comment form based on the dropdown selection using ajax.

Which can be achieved through this code

<?php comments_template(); ?> 

No API necessary.

I have it working but does not load on selection here hidden link

and the code I used is this.

 * New custom code snippet (replace this with snippet description).

toolset_snippet_security_check() or die( 'Direct access is not allowed' );

// Put the code of your snippet below this comment.

function get_custom_product_list() {

$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'post_status' => 'publish',

$the_query = new WP_Query( $args );
echo '<select name="product_id" >';
echo '<option value="">'.__("Select product").'</option>';
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
echo '<option value="'.get_the_ID().'">'.get_the_title().'</option>';
echo '</select>';
add_shortcode( 'product_list', 'get_custom_product_list' );


Languages: Englisch (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Paul,

I see what you are trying to do, however remember this code here.
<?php comments_template(); ?>

The context under which this is used is on a single post NOT a list of posts. In order for this to work in a list of posts, you will need to somehow create a function that will load the comment form that is specific to the ID of the post that is selected from your dropdown.

At the moment i'm not seeing a hook on wordpress that can do this, which is why I believe a complete custom solution is required.



Please get me a more experienced Support, please.

There are probably 1 million ways to do this.

I think we need someone with more experience and knowledge to help solve my issue.


I was able to accomplish with the code above to get all the product data from dropdown for 1 product. I am not experienced in javascript or Ajax so I am not able to get it to work properly. I am sure I can use custom css or php code to remove parts of data that I do not want or need.

You keep giving me dead-ends. Please allow a support staff with more experience and knowledge to take over my concern.



Languages: Englisch (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Paul,

I will be assigning this ticket to one of our 2nd tier supporters for further clarification.



Thank you, Shane.

New threads created by Beda and linked to this one are listed below:


Hello, I am Beda, as Shane already informed you he asked me to help you out here.

I see you want to "Output Review form based on Product Dropdown".
According to your opening comment, you want to create a page in which a customer can select any product from a dropdown and once selected it will display the Post Title, The Product Rating and The Product Reviews for the Product selected.

For me, that sounds like what we call a "Custom Search", or also known as "Custom Queries", "Front end search", etc.
You want a list of information related to the item selected in the DropDown (your search input).

Now, as Shane points out, Toolset Views would be the tool to create this, however, Toolset Views does not allow such searches by native Post Data, which amongst other, is Post Title, Author, ID, etc. It, however, allows you to search products matching certain Custom Fields (hence, reviews and ratings, if stored as Post meta, can be used in such filters).

To have a DropDown of custom fields to find products matching those values you can follow this DOC:

To add a Custom Search for the Post Title you have 2 options:
1. Either you store the actual post title in an additional Toolset Types Single Line field for each product (and use that field in the search)
2. Or, you can create a custom HTML Selector populated with the Titles of the Products (you can even use a View to populate this select Field) and then by adding a Query Filter to the View, make the view listen to the URL argument passed in the Select Input, so that when a user selects a specific title the URL is updated with the new search parameters and shows those results matching the post title chosen (query filters can have filters by title, front end search not).
I elaborate on this technique here:

As mentioned in all the related tickets this is not something natively possible, and hence, to have it implemented directly in Views, you'd have to ask for this here
This also would apply for reccommendations like 🙂

I see you then followed above suggestion #1 (just using a Taxonomy instead of a field, which is not wrong a all, it's a choice of how you administrate the data).

That seemed to not work as expected, however, that was not related anymore to the search, however to the display of the review form which is, when using that particular WooCommerce Views ShortCode, possible only on single product templates: instead can be used on the lists.

Related to your comment here, you mention to not use an API, but note that comments_template() is a method of an API; the WordPress API, actually, and that method will not work, just as the Toolset ShortCode for the exact same reason does not work, on lists of posts - but only on single posts.
Please consult the API DOC here:
(Will not display the comments template if not on single post or page, or if the post does not have comments.)

It's the WordPress Core, that does not allow that, and Toolset cannot help to change this.
I've tried to build a comments section in past (as a Layouts Custom Cell, actually) - and it does not work great on a post list.
I renounced to that and used Toolset Forms instead.

That won't help you here, as you need the specific WooCommerce Review mechanism, not just WordPress Comments.
To do this you need Custom Code that hooks in WooCommerce's and if required WordPress's API so to return the comments and reviews forms you need.
Those are by default only usable on single products.
You can see that people are actually struggling with this as well not using Toolset:

However, Toolset Support cannot help with such a Custom Code. This is elaborated here:

What we can help you with is build the things you can build with Toolset, we can also give ideas and suggest solutions or workarounds.

Hence, I would like to split this ticket in 2.
1. The ticket here we keep solely about "how to have a Front End Search (Select) by data like Post Title or Product data".
I can help you with this if more details are needed than shared above on the topic already
2. In another ticket, we can explore ways how to display and let users review a product on a Views that display such products.
One will need to analyse, where WooCommerce Stores that information, how it is displayed, and how we could gather it from users.
Please, can you elaborate precisely which data needs to be displayed and which you want to edit, here:

Possibly, we could use a Toolset Form, that lets you write a review, then apply a Custom Code to update the Product Reviews (comments).
There are some custom code samples online doing that already:
Now, for example, if you use a view, you could try returning that in a ShortCode and instead of the global post use a Toolset ShortCode to populate the ID of the comments form in the custom code above shared. ('post_id' => $postid, here use a Toolset Post ID ShortCode instead of global post id.)

I cannot write this code for you, but I can help analyse it if it does not work and give tips where to look next, if we can handle this in a separate new ticket, you may mention that I asked you to open one, so it gets assigned to me later.

Concluding, we will handle anything towards display or input of WooCommerce Review/Comment here, and anything related to search of that data we will continue to proceed in this very ticket here.

Please let me know if with above details you are able to create the required custom searches, and if possible, could you add the required details on the other ticket related to display of reviews in loops?