E
E
EvgenyApMr2019-09-23 01:29:03
WordPress
EvgenyApMr, 2019-09-23 01:29:03

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. 5d87f425c3df6060616554.jpeg
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

1 answer(s)
L
lukoie, 2019-09-23
@lukoie

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 question

Ask a Question

731 491 924 answers to any question