Skip Navigation

[Resolved] Custom product attribute url link from product archive

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 3 voices.

Last updated by Luo Yang 2 years ago.

Assisted by: Luo Yang.

Author
Posts
#2587479

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: hidden link (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 hidden link

What is the link to your site?
hidden link

#2587569

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

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 hidden link

You can preset the destination filter (which is filtering the product attribute destination) with a url parameter, like so:

hidden link

What are you aiming for with the other link you shared?

hidden link

That appears to be a static page.

How does it (or the links to it) relate to the product archive?

#2587571

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
hidden link
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
hidden link

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.

#2587911

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/

#2588149

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.

#2588581

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:

<a href="<em><u>hidden link</u></em>;">[wpv-taxonomy-title]</a>

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