Modify tags displayed for vendors in the add-product page
By default, we allow vendors to choose from a maximum of 45 tags and the tags are displayed even if they do not have any product assigned to them. The tags that have the highest number of products assigned to them are displayed first and the least are displayed last.
The following code modifies the default way it is displayed.
Lets get down to the nitty gritty details of the arguments passed in the above code.
- ‘hide_empty’- Has been set to true. This prevents tags that do not have any products assigned to them to be displayed to vendors. Setting it to false will display all the tags irrespective of products assigned to it.
- ‘orderby’- This is a clause that filters out the results on basis of certain parameters. By default, we sort the results by the number of products assigned to it – ‘count’, determines the same.
- ‘order’- This determines whether the results are to be shown in ascending (ASC)/ descending (DESC) order.
For a detailed idea on the accepted parameters read this documentation by WordPress.
Modify the way vendors are displayed on the vendor list page
All vendors registered on your website are displayed on the vendor list page according to the dates they’ve registered. But, going by our experience, few of our clients aren’t really satisfied with the date sorting procedure or would want to make additions to the filtering. In such a case, you can modify the accepted parameters. An example of this is shown in the snippet below
Again, the parameters we’ve passed are the ones we’ve already had a clear discussion on in our above section. However you can read more about these parameters and all the accepted arguments in this codex documentation.
That’s it folks! Easy as pie!