Hello there,
Good Day!!
Thank you for your kind words and for using our plugin!
We’ve added a dynamic class wrapper in the latest version (5.5.1) of our plugin. If your product is “in stock” with a specific quantity (for example, 2), the wrapper class will be cwginstock-2instock. You can leverage this class to display or hide the subscribe form using custom CSS.
Please update to our latest version (5.5.1) and try the following PHP and CSS snippets along with it:
- Custom PHP Snippet:
You can extend the allowed statuses to include instock
using the following:
add_filter('cwg_default_allowed_status', 'cwg_extend_stock_status');
function cwg_extend_stock_status($stock_statuses, $product, $variation) {
$stock_statuses = array_merge($stock_statuses, array('instock'));
return $stock_statuses;
}
2. Custom CSS Snippet:
To control the visibility of the subscription form for products with a stock quantity of 1, you can use this
section.cwginstock-subscribe-form {
display: none;
}
section.cwginstock-outofstock, section.cwginstock-1instock {
display: block !important;
}
Please note that the CSS code above has not been tested and may work differently with different themes.
Thanks.