Skip to main content

Add Custom Count Bubble

You are here:
← All Topics

This article belongs to our plugin : WooCommerce Customize My account Pro

You can add your own custom count bubble , here in this example we are adding new option called Display 9 , which output plain 9 number on frontend. you can display any custom dynamic value on bubble with this.

add_filter('wcmamtx_override_count_of_array','wcmamtx_override_count_of_array_function',10,1);

function wcmamtx_override_count_of_array_function($count_of_selectable) {
	
	$count_of_selectable['display_9'] = 'Display 9';	
	return $count_of_selectable;
	
}

add_action('wcmamtx_cutom_count_of_html','wcmamtx_cutom_count_of_html_function',10,4);

/*
 * $count_bubble - yes to enable , no to disable
 * $hide_empty   - value of hide empty checkbox
 * $count_of - dropdown value
 * $sidebar  - set null to disable in sidebar
 */

function wcmamtx_cutom_count_of_html_function($count_bubble,$hide_empty,$count_of,$sidebar) {
	    
		if (($count_bubble == "yes") && ($count_of == 'display_9') ) {
			?>
			<span class="<?php if (isset($sidebar)) { echo 'wcmamtx-banner-counter-sidebar'; } else {  echo 'wcmamtx-banner-counter';} ?>">
				<?php echo '9'; ?>

			</span>
			<?php
		}
	
}