Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 8 years ago.
Improve this questionIn a woocommerce theme, Im trying to show a warning when product is out of stock. Something like this:
<?php if ('this_product_is_out_of_stock'): ?>
<p>This product is out of stock. It can be purchased by custom made order.</p>
<?php endif; ?>
Is there a function to say 'this_product_is_out_of_stock' or some other way to achieve it?
I was searching woocommerce api docs unsuccesfully: /
Thank you in advance.
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 8 years ago.
Improve this questionIn a woocommerce theme, Im trying to show a warning when product is out of stock. Something like this:
<?php if ('this_product_is_out_of_stock'): ?>
<p>This product is out of stock. It can be purchased by custom made order.</p>
<?php endif; ?>
Is there a function to say 'this_product_is_out_of_stock' or some other way to achieve it?
I was searching woocommerce api docs unsuccesfully: https://docs.woocommerce/wc-apidocs/
Thank you in advance.
Share Improve this question asked Sep 4, 2016 at 6:54 aitoraitor 7252 gold badges8 silver badges23 bronze badges 1- 1 Questions about the inner workings of third party plugins are better asked at their author's forum, in this case: wordpress/support/plugin/woocommerce – cjbj Commented Sep 4, 2016 at 14:27
1 Answer
Reset to default 18Try something like this
global $product;
if ( ! $product->managing_stock() && ! $product->is_in_stock() )
echo '<p>This product is out of stock. It can be purchased by custom made order.</p>';