Answer the question
In order to leave comments, you need to log in
How to change in-stock output location in Woocommerce card?
Hello. After updating Woocommerce, there was a problem displaying the "In stock" (in-stock) field. It went to the very end of the parent block.
Now the output is done like this:
add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2);
function wcs_custom_get_availability( $availability, $_product ) {
if ( $_product->is_in_stock() ) {
$availability['availability'] = __('In stock', 'woocommerce');}
if ( ! $_product->is_in_stock () ) {
$availability['availability'] = __('Out of stock', 'woocommerce');}
return $availability;}
We need to do something to help push this filter into another filter by moving it.
Move here: add_filter( 'woocommerce_single_product_summary', 'is_stock', 11 );
Thank you very much in advance for your attention and help!
Answer the question
In order to leave comments, you need to log in
Go to the woocommerce directory and find the hook file there: woocommerce_hooks.php . All calls to add_action will be there. The one you need is woocommerce_single_product_summary and priority numbers.
In functions.php, you need to deactivate the action using remove_action, and then activate it in the right hook with the right priority.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question