Product Attributes Shortcode Wordpress Plugin - Rating, Reviews, Demo & Download
Plugin Description
Displays a list of links to all the terms from a specific WooCommerce product attribute via shortcode.
Perfect if, for example, you have a brands attribute with several brand terms (e.g. Apple, Microsoft) and you want to display a list of all the brand terms from this attribute with links to a page containing all products from a particular brand term. Maybe you have a color attribute, you can quickly add a list of all the colors from your store so a customer can click through and see all products that are a particular color.
We created this plugin out of neccessity because WooCommerce includes a “Filter products by attribute” widget, however this has a list of attribute terms which gets reduced once a term is clicked because the terms available are based on the products currently filtered (which could have other filters applied for category and other attributes). We needed to display a static list of terms which does not reduce as you click the terms to include in the footer of a website, we have also added the option to choose whether the term link should be a shop filter or an archive based link.
You can add the shortcode anywhere in your site, such as in pages, posts, widgets and directly in templates using do_shortcode (see FAQs).
Shortcode Example
The shortcode is:
[wcpas_product_attributes attribute="x"]
Replace x with your attribute name as shown on the WooCommerce edit attribute page.
Shortcode Attributes
Use the shortcode attributes below as needed, optional attributes do not need to be included in your shortcode if you wish to use the defaults:
attribute
REQUIRED – The name of your product attribute, use name as shown on the WooCommerce edit attribute page, default is empty
orderby
OPTIONAL – Use any orderby parameter, default is name
order
OPTIONAL – Use asc or desc, default asc
hide_empty
OPTIONAL – Use 1 to hide empty terms, 0 to disable, default is 1
show_counts
OPTIONAL – Use 1 to enable a count next to each term, 0 to disable, default is 0
archive_links
OPTIONAL – Use 1 to enable archive links on each term like /brand/sega, 0 to disable for links like /shop/?filter_brand=sega, default is 0
min_price
OPTIONAL – Use a number to enable links to include a minimum price filter, requires archive_links to be 0, default is empty
max_price
OPTIONAL – Use a number to enable links to include a maximum price filter, requires archive_links to be 0, default is empty
Shortcode Example
If you have a brand attribute, this shortcode will display all brand term links ordered by name in ascending order, hides links which contain no terms and shows a count of the terms next to the term link:
[wcpas_product_attributes attribute="brand" orderby="name" order="asc" hide_empty="1" show_counts="1"]
Screenshots
-
Shortcode being added via block editor
-
Attributes display in page/post
-
Attributes display in text widget