This topic has 2 replies, 2 voices, and was last updated 9 months, 2 weeks ago ago by Luca Rossi
We would need to show the quantity currently available in stock, next to the product pricing on the Shop page. We have tried adding the below hook but this is not working. Please fix the issue.
add_action( ‘after_etheme_product_grid_list_product_element_title’, ‘webarro_show_stock_shop’, 10 );
function webarro_show_stock_shop() {
global $product;
echo wc_get_stock_html( $product );
}
Dear Jaswinders,
We hope this message finds you well.
Please find below the correct hook for your reference:
add_action( 'woocommerce_after_shop_loop_item_title', 'webarro_show_stock_shop', 99 );
function webarro_show_stock_shop() {
if(is_shop()){
echo '<div class="custom-stock">';
etheme_show_single_stock();
echo '</div>';
}
}
We have included a conditional statement to ensure that the custom stock information is displayed exclusively on the SHOP page. Additionally, we have encapsulated the output within a DIV element to facilitate the application of custom CSS styling:
div.custom-stock p {
/* Custom CSS here */
}
Should you require any further assistance or have any queries, please do not hesitate to contact us.
Best regards,
The 8Theme Team
You must be logged in to reply to this topic.Log in/Sign up