// Out of stock for general woocommerce – might help someone
function product_in_stock($post, $product) {
if (!$product->is_in_stock()) {
$STOCK = TRUE;
return $STOCK;
} else {
return false;
}
}
function check_if_out_of_stock(){
global $post,$product;
$stock = product_in_stock($post,$product);
$output="<div class="";
$output .= $stock?"instock":"outofstock";
$output .= '">';
echo $output;
}
add_action( 'woocommerce_before_shop_loop_item', 'check_if_out_of_stock');
function close_out_of_stock(){
echo "</div>";
}
Related Posts:
- Show Woocommerce minicart widget in checkout page sidebar? And, how to make this update secure by overriding widget?
- Woocommerce Product Category Widget – hide categories that have no products in stock [closed]
- Bookshelf plugin and/or widget [closed]
- Copy widget settings from one blog to another
- Display specific widgets in different area’s around the page
- Edit and make class-wc-widget-featured-products.php update-proof
- How to create a ‘single’ category widget for woocommerce plugin [closed]
- Show Woocommerce Product “attributes/extra information tab” in widget [closed]
- How add short description Featured Products or Related Products
- Widget does not work with WooCommerce enabled
- How Can I Add the “Insert From URL” Tab to a Custom 3.5 Media Uploader?
- Enabling free shipping on Woo Commerce by specific items [closed]
- How do I rebind event after widget save
- What is the best way to include a widget in a Page?
- Difference between widget form code variables
- How to create a widget that has a submit form in the front end
- Custom shortcode in widget forced to top of widget
- Separate backend “Widgets” page for each language
- How Can I Register Menus and Widgets Conditionally Based on Theme Options/Settings?
- Where (what direcory) are the default WordPress Widget Codes stored?
- How can I retrieve data within my widget
- check for shortcode in post/pages AND widgets AND template files
- Why can’t I add this feed to the RSS widget?
- Using Advanced Custom Fields in a widget
- Closest thing to an is_widget() tag?
- Why won’t my custom widget stay in the sidebar after a reload?
- How to “pair” two widgets side by side in one sidebar [closed]
- Is there plugin to show recent posts from one website in the widget area of another?
- Can I use a form in a dashboard widget?
- Custom dashboard widget search box
- Notice: Undefined index: filter in …wp-includes/default-widgets.php on line 382
- Need some help understanding widgets
- register widget class not written in theme
- Font awesome Icon HTML in widgets disappear on save
- I wrote my plugin. How to display the result of the plugin’s function to sidebar (widget?)?
- Hide widget if user is logged in without plugin
- Toggle option in sidebar widgets
- for class wp_widget, in what order are the member functions called?
- unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘)’ in widget [closed]
- How can hide widget title if custom widget is empty
- Adding widgets to header and footer from plugin
- styling back end widget form and enabling multi widget feature
- How to show different widgets on different pages in a user friendly way
- Elementor widgets – conditional controls
- WordPress Tag Cloud args (font-size) not working since wp update 4.9
- Which widget to use for display category post with view more? [closed]
- WordPress Widget Not Saving Data
- In the archive widget, how do I sort in between two years?
- Wysiwyg editor errors
- Problem creating an array instance in a widget in 4.4 update
- Redirect to page after a widget form submit
- Conditional tag in Widget Logic for checking if top level page or if subpage
- Where to put custom widget file?
- Problem since update 3.5 [duplicate]
- How to disable a widget when dependent plugin is inactive?
- How to pass a special CSS class into widget li
- How to use the widget area to extend the page content?
- Is there a simple way to have a new sidebar for each page?
- Removing widget from home page when coming from specific landing page
- In which folder can we find the core wordpress Widgets such as Menu Widget
- How do I insert an amazon search widget into posts or pages?
- How to remove Help tab and the Dashboard widget area’s empty border
- Add drop down to widget if it is in a certain area
- using get_template_part() inside a widget and passing variables
- New Widget are not showing
- How do I exclude portrait pictures from the nextgen gallery sidebar widget?
- Add html after the first widget in a sidebar
- How to use multiple instances of Deal or Announcement With Countdown Timer Plugin Widget
- Truncate Widget Title
- Is there any plugin to show number of clicks on the link?
- co-authors plugin – inline listing
- Change language in SiteOrigin Widgets
- Some Widgets in the Right Side Bar and the whole Footer section is not working in a WordPress Site
- Widgets are not displaying in my theme
- how to make video autoplay in widget
- Woocommerce categories displayed on every category and shopping page
- Custom archive widget drop down menu
- Widget outputting JS as plain text
- How to show Widget in Content Bottom part on home page in twenty sixteen theme
- get_post_class not working properly
- Is it good practice to change certain page appearance through a widget?
- widgets_init actions not fired from functions.php’s child theme
- Plugin Works, but Widget Doesn’t
- How to get data from one wordpress site to another
- Widget Script Loads at Bottom of Page
- Target logic based on Widget / Sidebar Name
- Why is the phone number a hyperlink on desktop sites, in my widget?
- $before/after_widget/title not displaying anything
- can’t edit widgets after moving from subfolder to root
- register_sidebar() will not wrap an element properly
- Page full of widgets?
- Big side banners
- Widget page broken
- Widget Disappearing in IE
- How to hide sidebar widgets in all pages except Hompage?
- Extending Widgets – Exclude # of posts field from Recent Posts Widget
- WooCommerce product prices not showing up correctly [closed]
- Footer option is missing in Customiser
- Theme Widget Area Defaults
- How to add the “page” post type to Recent Activity widget displayed in admin?