Tell us what you are trying to do?
Hi, I'm currently using Toolset to show a custom layout for the WooCommerce products. Part of that is to show the attributes for the shown product. Currently the link shown for the attribute is like this: lien caché (for the attribute Destination and the value of Botswana) but ideally I'd like the url returned so can load the filtered shop url showing the selected attribute, in this case it would be lien caché
What is the link to your site?
lien caché
Hi Tim
Sorry, could you elaborate, I don't quite follow what you are aiming for.
I see you have a custom product archive (shop page), at lien caché
You can preset the destination filter (which is filtering the product attribute destination) with a url parameter, like so:
lien caché
What are you aiming for with the other link you shared?
lien caché
That appears to be a static page.
How does it (or the links to it) relate to the product archive?
Hi Nigel
In the custom archive page I'm using for the products archive it displays the attribute as a link in the following format
lien caché
This currently goes nowhere as it doesn't have an archive page.
Instead of that like I'd like them to instead display to a filtered list on the product archive so something like this
lien caché
This would be the same for a few other attributes that I will have on each product so if there was a way to rewrite the link url and replace "?taxonomy=pa_" with "plan-your-trip/?filter_" it should then function as required.
Hello,
You can follow our document to design the shop page with Toolset WordPress Archive:
https://toolset.com/course-lesson/building-a-custom-woocommerce-shop-page/
In the WordPress Archive, add a custom search form, filter by taxonomy "pa_destination", setup the URL parameters as "filter_destination", see our document:
https://toolset.com/course-lesson/creating-a-custom-search/
So when you pass the URL parameter "pa_destination" to shop page, it will filter the results by URL parameter
If you don't want to use Toolset to design the shop page, you can consider custom codes, for example use WordPress built-in action hook "pre_get_posts" to trigger a custom PHP function, in this function check if it is shop page("Product" archive page), then add the taxonomy filter to the query:
https://developer.wordpress.org/reference/hooks/pre_get_posts/
https://developer.wordpress.org/reference/classes/wp_query/
Hi Luo
Thanks for that, I'm already using Toolset to use a custom template for the shop archive. Its was really just a question of if there was a way to amend the link thats currently coming from the fields and text block thats being used to show the associated attributes so that rather than it going to a separate taxonomy page it went back to a filtered list on the shop page. The filter is already in place by loading the link its just amending the called url that I'm trying to get round currently.
You can setup the link manually, for example:
1) Enable legacy editor:
https://toolset.com/course-lesson/enabling-legacy-version-of-toolset-views/
2) Dashboard-> Toolset-> Views, Create a taxonomy view:
- Query pa_destination taxonomy terms
- Filter by:
Taxonomy is set by the current post
- In view's loop, setup the term link manually with HTML codes, for example:
<em><u>lien caché</u></em>
In single product post, display above taxonomy view's shortcode:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-view
Please let me know if you need assistance to setup it