[Support request] How to s

Home Forums Support [Support request] How to s

Home Forums Support How to s

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1565377
    Jaime

    I am using the below code to hide the “Out Of Stock” status from the products which are out of stock because I am showing them for pre-order.

    .woocommerce div.product .out-of-stock {
    display: none;
    }
    .woocommerce div.product p.stock {
    display: none;
    }

    It is working good… But now I want to show the Out Of Stock on products but when removing this code, out of stock is showing on all products even on Pre-order.

    All the pre-orders products are showing because I have created a particular “pre-order” tag for them. So, I want to show the out of stock status but not for the products that they pre-order tag.

    So, it is possible to hide the Out Of Stock from pre-order tagged products only…

    Can you customize it a bit for me? Thanks for your help!

    #1565540
    David
    Staff
    Customer Support

    Hi there,

    maybe this stack overflow method would be a good solution:

    https://stackoverflow.com/a/41162894

    It will allow you to change the Sold Out text to something else on products with a certain tag.

    #1566144
    Jaime

    Hey, David!

    It is working as I wanted… Just one more help, I want to change the Out Of Stock text to Sold Out.

    Can you help with this?

    Thanks

    #1566324
    Leo
    Staff
    Customer Support

    Something like this might help:
    https://www.wpdecoder.com/php/woocommerce-change-out-of-stock-text/

    These things are handled by WooCommerce so it’s kind of out of the scope of this forum.

    But if you Google “change out of stock text woocommerce” then there should be lots of suggestions 🙂

    #1567682
    Jaime

    I am using the code:


    add_filter('woocommerce_get_availability', 'availability_filter_func');
    function availability_filter_func($availability)
    {
    $availability['availability'] = str_ireplace('Out of stock', 'Sold Out', $availability['availability']);
    return $availability;
    }

    But it is again showing for all the products, including pre-order tagged also. Can you customize it a bit so It doesn’t show on pre-order tagged products?

    Thanks

    #1567694
    Leo
    Staff
    Customer Support

    This is a WooCommerce filter so please check with their support team first.

    Found an article that might be related as well:
    https://stackoverflow.com/questions/58438442/conditional-tag-for-woocommerce-pre-order-products

    You can also try a forum like this for questions that are not related to the theme:
    https://wordpress.stackexchange.com/

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.