I've tried to use Get the total stock of all variations from a variable product In Woocommerce, trying to make working this code:
add_action( 'woocommerce_after_shop_loop_item_title', 'display_variable_product_stock_quantity', 20 );
function display_variable_product_stock_quantity(){
wc_get_variable_product_stock_quantity( 'echo_html' );
}
with this one:
add_action( 'woocommerce_single_product_summary', 'display_variable_product_stock_quantity', 15 );
function display_variable_product_stock_quantity(){
wc_get_variable_product_stock_quantity( 'echo_html' );
}
Or is it possible to get the total stock in the default element of quantities? for example. The stocks will be displayed in the highlighted below: