I want to display "related products" on the product page. the related products all share the same value of a custom field of the product that you are currently viewing.
I have tried the various filtering options, and cannot find any that works, and not sure the best way to do this please can you advise.
You are displaying a product, and that product has some value for a custom field.
You want to show other products that also have the same value for that same custom field, yes?
As a Lifetime user I'm guessing you are familiar with the legacy Views editor and inserting Views via the wpv-view shortcode.
You need to create a View to display products, and include a Query Filter for the custom field in question.
But what value should it filter by?
Well, you need to pass the value to the View via shortcode attribute, so you will specify in the Query Filter a shortcode attribute that it should get the value from, and then you will provide the value by adding the attribute to the wpv-view shortcode where you insert the View.
The last point is what value to pass via the attribute. It should be the value of the field for the current product being displayed.
So you can generate that value via shortcode, probably a good idea to use the wpv-post-field shortcode (it generates the raw field value, which is what you would need to filter by), so that your View would be inserted via a shortcode something like:
I did already try that with and without the closing ' and ] incase that was something related to it not working. here is the screenshots. I have tried it both as a shortcode on the page, as well as using a content template where I contain the view query.
I have left the query filter at the top of the view blank, because I couldn't see that there was a way for me to query it based on that field entry value.
Any ideas why is it not working from your filter instruction?
Great thanks I thought I was missing something somewhere, you may want to update the details on that link you provided, as it doesn't explain to include the shortcode in the query filterby.