Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1351153
    huylam1
    Participant

    Hi there,

    How do I change the text for the inventory on individual product page? Right now it says ‘# in stock’. I would like to change it to ‘# spots left’.

    Thank you.

    #1351306
    Rahul
    Moderator

    Hi There,

    Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    #1351806
    huylam1
    Participant
    #1351979
    Christopher
    Moderator

    Hi there,

    Please add following code in child theme’s functions.php :

    add_filter( 'woocommerce_get_availability', 'custom_get_availability', 1, 2);
    
    function custom_get_availability( $availability, $_product ) {
      global $product;
      $stock = $product->get_total_stock();
    
      if ( $_product->is_in_stock() ) $availability['availability'] = __($stock . ' SPOTS LEFT', 'woocommerce');
    
      return $availability;
    }

    Hope it helps.

  • <script> jQuery(function($){ $("#no-reply-1351153 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>