Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi Lorro,

    Thanks for your shortcode!

    I tried to change your code, but it didn’t work out.
    (I’ve tried also with this one: https://ww.wp.xz.cn/support/topic/shortcode-for-stock-status-as-text/-

    I want to make a page with an overview of 10 products and their availability.

    On the productpage I’ve changed the availability like this:

    
    add_filter( 'woocommerce_get_availability', 'mw_get_availability', 1, 2 );
    function mw_get_availability( $availability, $_product ) {
        global $product;
        // change text "In Stock' to 'SPECIAL ORDER' when quantity more than 6
        if ( $_product->is_in_stock() && $product->get_stock_quantity() > 15 ) $availability['availability'] = __('Meer dan 15 plaatsen beschikbaar', 'woocommerce');
        // change text to n Spots Left, where n is the quantity
        if ( $_product->is_in_stock() && $product->get_stock_quantity() <= 15 ) $availability['availability'] = $product->get_stock_quantity() . __(' plaatsen beschikbaar');
        // change text "Out of Stock' to 'SOLD OUT'
        if ( !$_product->is_in_stock() ) $availability['availability'] = __('Deze trip is reeds volzet. Wil je op de wachtlijst komen? Stuur dan een mailtje naar [email protected] .', 'woocommerce');
    
        return $availability;
    }

    This I also would like to post newt to the 10 product on the availability overview page.

    Could you help me?

    Thx in advance!

    Sander

Viewing 1 replies (of 1 total)