Support » Plugin: WooCommerce » [Plugin: WooCommerce – excelling eCommerce] Changing 'Out of stock' to 'coming soon&

Viewing 15 replies - 1 through 15 (of 36 total)
  • Plugin Author royho

    (@royho)

    I am not sure if there are any filters to change that text…But if there are not, then you can always use PO files to do so….have a look at this -> http://wordpress.org/support/topic/plugin-woocommerce-excelling-ecommerce-rename-categories-and-products?replies=36

    Hi,

    I gave that a go but still couldn’t find or change the ‘out of stock’ text:
    <img src=”http://i.imgur.com/fxlYg.png” alt=”” title=”Hosted by imgur.com” />

    Surely it’s in a php file somewhere? I’m using the maya theme.

    Assuming that you’re not using a totally customized theme for WooCommerce that implements some of its own layout code ( such as the Shelflife theme ) …

    Look for the loop/price.php template file and modify that.

    Change it to something like this:

    <?php $price_html = $product->get_price_html() ?>
    
    	<span class="price">
    		<?php
    		    if ( empty( $price_html ) )
    			    echo 'Coming Soon!';
    		    else
    			    echo $price_html
    		?>
    	</span>

    That’s all there is to it 😉

    there’s also a price.php under single-item, so you’ll need to modify that one as well.

    The original poster wrote “I found the file to change it on the single product page” so he’s obviously found the price.php file in the “single-product” subdir 😉

    my sincere apologies for my superfluous comment!

    not superfluous at all, I didn’t know I had to change that file as well, thanks for the heads up everyone.

    Hi there! I want to do the same but add a “SOLD” sign instead of the “OUT OF STOCK” sign on a product’s image. Any help would be greatly appreciated. Thanks,

    I am trying to add some text which says “Coming Soon” as above from the original post. I have tried the above code and changed my loop/price.php to look like this:

    <?php
    /**
    * Loop Price
    */

    global $product;
    ?>

    <?php /*?><?php if ($price_html = $product->get_price_html()) : ?>
    <span class=”price”><?php echo $price_html; ?></span>
    <?php endif; ?><?php */?>

    <?php $price_html = $product->get_price_html() ?>

    <span class=”price”>
    <?php
    if ( empty( $price_html ) )
    echo ‘Coming Soon!’;
    else
    echo $price_html
    ?>
    </span>

    And I have changed the single-product/price.php to look like this:

    <?php
    /**
    * Single Product Price
    */

    global $post, $product;
    ?>
    <p itemprop=”price” class=”price”>

    <?php //echo $product->get_price_html(); ?>

    <?php $price_html = $product->get_price_html() ?>

    <?php
    if ( empty( $price_html ) )
    echo ‘Coming Soon!’;
    else
    echo $price_html
    ?>

    </p>

    But it is still not working, any suggestions?
    Thanks

    Yo! I just managed it.

    Go to woocommerce/classes and find the file class-wc-product.php

    There are three instances of:

    $availability = __(‘Out of stock’, ‘woocommerce’);

    within the file.

    I changed ‘Out of stock’ to ‘Sold’ and it worked for me.

    Lovely stuff!

    Absolute legend! worked for me too, thanks a million

    you shouldn’t modify the core woocommerce files. That’s what hooks and template files are for.

    It did not work for me 🙁 I changed all three options and nothing happened. The out of stock sign was still there unfortunately. Any other way maybe?

    i get a fair few errors on the admin area when modfying those files.
    Who knows how to do this using hooks???

    add_filter(‘woocommerce_get_availability’, ‘availability_filter_func’);

    function availability_filter_func($availability)
    {
    $availability[‘availability’] = str_ireplace(‘Out of stock’, ‘Coming Soon’, $availability[‘availability’]);
    return $availability;
    }

Viewing 15 replies - 1 through 15 (of 36 total)
  • The topic ‘[Plugin: WooCommerce – excelling eCommerce] Changing 'Out of stock' to 'coming soon&’ is closed to new replies.