The WCBoost – Products Compare plugin includes some shortcodes to enhance your WooCommerce store’s product comparison functionality. This guide will explain each shortcode, its usage, and available attributes.
Table of Contents
1. Comparison Table
This shortcode generates the main comparison table, displaying selected products side by side for easy comparison.
Usage:
[wcboost_compare]
Attributes:
fields
: Specifies which product details should be compared.
Example:
[wcboost_compare fields="rating,price,stock,sku,dimensions,weight,attribute:color,attribute:size,add-to-cart"]
Notes:
- This shortcode is typically used on the dedicated Compare Page.
- Customize the
fields
attribute to control which product details are compared. - Use the
attribute:
prefix to include product attributes in the comparison.
2. Compare Button
This shortcode generates a compare button for a specific product, allowing users to add the product to their comparison list.
Usage:
[wcboost_compare_button]
Attributes:
product_id
: Specifies the ID of the product for which to display the compare button.
Example:
[wcboost_compare_button product_id="123"]
Notes:
- If no
product_id
is specified, the shortcode uses the ID of the current product. - This shortcode is useful for displaying compare buttons in custom locations or for specific products.
- For detailed information on configuring and customizing the Compare button, please refer to our documentation on Compare buttons customization.
3. Similar Products
This shortcode displays a list of similar products for a given product, enhancing cross-selling opportunities.
Usage:
[wcboost_compare_similars]
Attributes:
product_id
: The ID of the main product for which to display similar products.limit
: The number of similar products to display (default: 12).columns
: The number of columns to use when displaying similar products (default: 4).
Example:
[wcboost_compare_similars product_id="123" limit="8" columns="4"]
Notes:
- If no
product_id
is specified, the shortcode uses the ID of the current product. - This shortcode is ideal for product pages or custom layouts where you want to showcase related items.
- To ensure the Similar Products feature displays accurate results, the “Comparision data tracking” setting must be enabled. You can find this setting at WooCommerce > Settings > Products, in the Products Compare section.
How Similar Products Are Calculated:
The WCBoost – Products Compare plugin uses an intelligent algorithm to determine similar products. The plugin monitors and analyzes comparison data for each product in your store. Similar products are identified based on how frequently they are compared with the given product. This analysis is ongoing, ensuring that the list of similar products stays current with customer behavior.
As a result, the “similar products” displayed are those most frequently compared with the main product by your customers. This data-driven approach provides a more relevant and user-centric recommendation system compared to traditional category or tag-based similarity.
Remember to always inform your customers about data collection practices and ensure compliance with relevant privacy regulations when using features that involve user tracking.