Home Remove Quantity number before stock status in Woocommerce?
Reply: 0

Remove Quantity number before stock status in Woocommerce?

user2899 Published in May 20, 2018, 3:22 pm

i use plugin called WC Product Stock Status into my Woocommerce site, and want to remove number before stock status. I tryed to see if quantity number is set in different CSS class, but seems that is all in one class, so hidding via CSS looks not possible.

.woocommerce div.product p.stock
{font-size: .92em;}
.woocommerce div.product .s_in_stock_color {

Unfortinally this plugin is outdated and looks no longer supported be author, so asking question on plugin page, is useless. So i want just to remove number of quantity that is in stock, and keep the label, like on image bellow:

I checked into code and found that that table is generated fetching this data in class-variable-status.php file:

 public function print_stock_status(){
    global $product; 

    if($product->is_type( 'variable' ) ) {
        $childrens = $product->get_children();
        $values = array();
        foreach($childrens as $child){
            $prod = wc_get_product($child);
            $search_replace = array();
            $search_replace['%formatted_name%'] = $prod->get_formatted_name();
            $search_replace['%name%'] = wc_get_formatted_variation($prod);
            $search_replace['%sku%'] = $prod->get_sku();
            $search_replace['%id%'] = $prod->get_id();

            $format = wc_pstocks_option('variable_title');
            $format = str_replace(array_keys($search_replace),array_values($search_replace),$format);
            $status = $prod->get_availability();;
            $status['title'] = $format;
            $status['ID'] = $child;
            $status['formatted_name'] = $prod->get_formatted_name();
            $status['name'] = wc_get_formatted_variation($prod);
            $status['sku'] = $prod->get_sku();
            $status['id'] = $prod->get_id(); 
            $values[$child] = $status; 

 public function generate_table($values){

and this is code from stock-variation- table.php


    foreach($args as $arr){ 
        $text = empty($arr['availability']) ? '' : '<p class="stock '.esc_attr($arr['class']).'">'.$arr['availability'].'</p>'; 
        echo '<tr>';
        echo '<td>'.$arr['title'].'</td>';
        echo '<td>'.$text.'</td>';
        echo '</tr>'; 


I think that something neeed to be updated into this line:

            $text = empty($arr['availability']) ? '' : '<p class="stock '.esc_attr($arr['class']).'">'.$arr['availability'].'</p>'; 

Any help how to remove that?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302551 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO