How to show countdown timer or counter bar in products grid?

Hi,

I’ve installed a plugin for my shop made with Woo that makes me create scheduled temporary sales. This plugin allow me to put a timer in my products grid in shop page with a code in the function.php file.

I tried to paste this code but unfortunately it didn’t work.

https://xlplugins.com/documentation/finale-woocommerce-sales-countdown-timer-scheduler-documentation/how-tos/how-to-show-countdown-timer-or-counter-bar-in-products-grid/

In the above link the plugin devs suggests to ask theme devs to find a solution if the fix doesn’t work. The code is already pasted in my function.php, a campagne is active, but I can’t see no timer in my grid.

Could you please help me? They say it’s just “correcting hook and replacing ‘woocommerce_proper_shop_loop_position’”…

Thanks in advance :slight_smile:

Regards

Hello There,

Thanks for posting this very detailed post information. I have check the code in the link. The code did not work because there is no woocommerce_proper_shop_loop_position filter in WooCommerce. You will have to replace it with any of the following:
woocommerce_before_shop_loop_item
woocommerce_before_shop_loop_item_title
woocommerce_shop_loop_item_title
woocommerce_after_shop_loop_item_title
woocommerce_after_shop_loop_item

Please let us know how it goes.

YEAH!

It works! :smiley:

I switched from woocommerce_proper_shop_loop_position to woocommerce_after_shop_loop_item.

Thank you so much for all of your help and for the patience to read the article in the link :slight_smile:

You rock! :wink:

Hey There,

You’re welcome! We are just glad we were able to help you out.
Thanks for letting us know that it has worked for you.

Cheers.

Hi there,

I’m here again to ask you if it’s possible do some tweaking on the php of this plugin.

I’ve upgraded the Finale XL plugin and created three different campaigns. Each campaign has different style attributes so in the product detail page the counter bar has different color: red, orange and yellow.

I actually paste this code in my function.php so I can show a counterbar also in the grid (the same I did for the timer)

/**
 * Customize and show inventory bar on grid
 */
add_filter("wcct_add_bar_to_grid", "custom_wcct_add_bar_to_grid");

function custom_wcct_add_bar_to_grid($config)
{
    $config  = array(
        'skin' => 'stripe_animate',
        'edge' => 'smooth',
        'orientation' => 'rtl',
        'height' => '12',
        'bg_color' => '#dddddd',
        'active_color' => '#00b5f6',
        'display' => "Solo <span>{{remaining_units}}</span> rimanenti!\n{{counter_bar}}",
        'border_width' => '1',
        'border_color' => '#444444',
        'border_style' => 'none',
    );
    return $config;
}

Now with this settings the counterbar will always be the same for all of the campaigns, with this light blue color, despite each campaign has different color (red, orange and yellow). This settings works fine because I can choose the displayed text and the height of the bar (in the product detail page text and height are different).

But if I change the code with this snippet I can achive a pretty good result, showing the actual color of the campaign BUT I need to change the height and the displayed text as in the first screenshot.

/**
 * Call Counter Bar in product loop below product name using shortcode.
 * This inherit product's bar settings and follow campaign rules.
 */
add_action('woocommerce_after_shop_loop_item', 'wcct_shop_loop_bar_display', 5);
if (!function_exists('wcct_shop_loop_bar_display')) {
  function wcct_shop_loop_bar_display() {
	  echo do_shortcode('[finale_counter_bar skip_rules="no"]');
  }
}

Now, here’s my question: is there a way to override the settings of the second snippet so I can set an height of twelve and a displayed text like in the first snippet?

Hope I explained my self… ^^’

Thanks in advance

Regards :slight_smile:

Hey @frankie_design,

Regretfully, additional help regarding this topic would be outside the scope of our support moreover we do not have support for third party plugins. For that, you’ll need to hire a web developer.We do have an in-house custom development team that offer paid services, who may be able to assist. They can be contacted at pinnacle@theme.co if this is of interest to you.

Thank you for your understanding.

Hi,

I understand, it’s fair. I’ve already asked the plugin developers for support but they did not answer me yet …

The site is not mine so I can not make decisions. If my clients want fast support I’ll definitely contact your dev :slight_smile:

Thanks for all of your support, you rock!

You’re welcome.

Hey,

plugin devs just text me back with a solution. Maybe someone else needs this…

They explained me that to achive what I need I have to change the beginning of the code with the ID of the campaign, like this:

add_filter("wcct_add_bar_to_grid_XXXX", "custom_wcct_add_bar_to_grid_XXXX");

function custom_wcct_add_bar_to_grid_XXXX($config)

The Xs are the numbers of the campaign ID. This way you can totally customize your campaign.

Hope this will be useful!

Thanks a lot for sharing this. :slight_smile:

1 Like