WordPress.org

Ready to get started?Download WordPress

Forums

Change available to back order text (3 posts)

  1. brshcollective
    Member
    Posted 5 months ago #

    Hi There

    I'm using woocommerce and I want to change the text on a product from 'available to backorder' to 'Will ship in March'

    I used the code below to change the out of stock text but can't seem to find the code I need to change this.

    Thanks in advance

    add_filter( 'woocommerce_get_availability', 'custom_get_availability', 1, 2);
    
    // Our hooked in function $availablity is passed via the filter!
    function custom_get_availability( $availability, $_product ) {
    if ( !$_product->is_in_stock() ) $availability['availability'] = __('Available Again Soon, Due in 14 March 2014', 'woocommerce');
    return $availability;
    }
  2. LittleHouseWeb
    Member
    Posted 5 months ago #

    This should be what you are looking for:

    function backorder_text($available) {
    
    foreach($available as $i) {
    
    $available = str_replace('Available on backorder', 'Will ship in March', $available);
    
    }
    
    return $available;
    }
    add_filter('woocommerce_get_availability', 'backorder_text');
  3. brshcollective
    Member
    Posted 5 months ago #

    Thanks so much @littleHouseWeb, this worked perfectly!

Reply

You must log in to post.

About this Topic