Tell us what you are trying to do? Show number of posts added to comparison table. When users add an item to compare, it will say "X posts added to compare." It can be a button, text, or floating widget, anywhere as long as there's an indicator.
Is there any documentation that you are following? I already set up a comparison tool using this doc: https://toolset.com/learn/create-an-ecommerce-wordpress-site/product-comparison/
Is there a similar example that we can see? I want to achieve something similar to this demo: hidden link (I was planning on using this plugin but apparently it only works on WooCommerce)
What is the link to your site? The property comparison page on our website is hidden link?
Hi,
Thank you for contacting us and I'd be happy to assist.
To show the count of selected items for the comparison, you'll need to include some custom script.
For example, on the properties page, you can add the following HTML code, where you'd like to show this count:
<div class="compare-counter">
<span>0</span> post(s) added to compare.
</div>
Next, in your view's "JS editor" tab, you can include the following script, which will execute whenever the compare label for any property will be clicked and will update the count value in the span tag, based on the number of checked items:
jQuery( document ).ready(function() {
// trigger when any compare label is clicked
jQuery( ".list-compare-wrapper label.compare" ).click(function() {
// get the count of selected checkboxes
var count = jQuery(".list-compare-wrapper label.compare input:checked").length;
// update the count text
jQuery('.compare-counter span').text(count);
});
});
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
My issue is resolved now. Thank you!