• Resolved bieke81

    (@bieke81)


    Hi,

    Loving the plugin, but we have a small issue that we are wondering there is a workaround for. Right now, when a product is added to the wishlist people can see on their wishlist if it’s in stock or not, which is what we would love to show. But when a product is in backorder it also shows as in stock. Is there a way to show it as on backorder, or are we out of luck on that? If so, we’ll just disable that part of the wishlist, but we’re hoping there is a workaround for it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Juan Coronel

    (@juaancmendez)

    Hi there,
    thanks for contacting us!

    To achieve what you need, please add the following code in the functions.php file of your active theme:

    if ( ! function_exists( 'yith_wcwl_stock_status_custom' ) ) {
    function yith_wcwl_stock_status_custom( $stock_status_html, $item ) {
    if ( 'out-of-stock' === $item->get_stock_status() ) {
    $stock_status_html = '<span class="wishlist-out-of-stock">' . esc_html( apply_filters( 'yith_wcwl_out_of_stock_label', __( 'Out of stock', 'yith-woocommerce-wishlist' ) ) ) . '</span>';
    } elseif ( 'available-on-backorder' === $item->get_stock_status() ) {
    $stock_status_html = '<span class="wishlist-in-stock">' . esc_html__( 'On backorder', 'yith-woocommerce-wishlist' ) . '</span>';
    } else {
    $stock_status_html = '<span class="wishlist-in-stock">' . esc_html( apply_filters( 'yith_wcwl_in_stock_label', __( 'In Stock', 'yith-woocommerce-wishlist' ) ) ) . '</span>';
    }

    return $stock_status_html;
    }

    add_filter( 'yith_wcwl_stock_status', 'yith_wcwl_stock_status_custom', 10, 2 );
    }

    Could you check it, please?

    Best regards.

    Thread Starter bieke81

    (@bieke81)

    That worked perfectly, thank you!

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