This code is working for old theme which i had but with this new theme it is not working

This topic has 6 replies, 3 voices, and was last updated 11 months, 1 weeks ago ago by Andrew Mitchell

  • Avatar: uday
    uday
    Participant
    January 15, 2024 at 20:39

    function change_specific_availability_text( $availability ) {

    if ($availability[ ‘class’ ] == ‘available-on-backorder’) {

    $availability[ ‘availability’ ] = __( ‘This product or product color selected is in central ware house will take additional 4 or 5 days to disptach’, ” );

    }

    return $availability;

    }
    add_filter( ‘woocommerce_get_availability’, ‘change_specific_availability_text’, 10, 1 );

    5 Answers
    Avatar: uday
    uday
    Participant
    January 15, 2024 at 20:40

    if the product is on back order i just want to notify user that it takes time instead showing message “Available on back order”

    Avatar: Justin
    Luca Rossi
    Support staff
    January 16, 2024 at 10:22

    Dear Uday,

    We hope this message finds you well.

    We suggest utilizing the code snippet provided below to achieve the desired functionality:

    
    function change_specific_availability_text( $availability, $product ) {
        if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) {
            $availability = $product->backorders_require_notification() ? __( 'Availability Notice: The selected product or color is located in our central warehouse and may require an additional 4 to 5 days for dispatch.', 'woocommerce' ) : '';
        } elseif ( ! $product->managing_stock() && $product->is_on_backorder( 1 ) ) {
            $availability = __( 'Availability Notice: The selected product or color is located in our central warehouse and may require an additional 4 to 5 days for dispatch.', 'woocommerce' );
        }
        return $availability;
    }
    add_filter( 'woocommerce_get_availability_text', 'change_specific_availability_text', 999, 2 );
    

    Please implement this code to adjust the availability text for products that are on backorder.

    Should you require any further assistance, please do not hesitate to contact us.

    Best regards,
    The 8Theme Team

    Avatar: uday
    uday
    Participant
    January 19, 2024 at 20:48

    This is fine but color of text is green, but i want to make it bold and red color for better visibitly to customer like a warning. (Any small Code snippet to make it happen)

    Please contact administrator
    for this information.
    Avatar: Justin
    Luca Rossi
    Support staff
    January 20, 2024 at 16:13

    Hi @uday,

    Please add the following CSS codes under Theme Options > Theme Custom CSS > Global CSS:

    
    p.stock.available-on-backorder.step-1 {
        color: red;
        font-weight: bold;
    }
    

    One more small thing : https://www.***.com/product/korean-necklace-set-125/ in this one go to gold color and see the message should be shown in green as item is in stock dont know why it is showing in red color.( I want to make it green as item is in stock)

    The color can be changed under Theme Options > WooCommerce(Shop) > Shop Elements > Advanced Product Stock:

    https://prnt.sc/986CWZ0AWCDD

    Best regards,
    The 8Theme Team

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    January 20, 2024 at 21:37

    Dear uday,

    In the spirit of gratitude, we want to express our appreciation for your trust in our products. As a valued customer, your experience matters greatly. Would you consider sharing it by giving our theme a deserving 5-star rating on ThemeForest?

    Click here to share your thoughts: https://themeforest.net/downloads

    Being part of our community means a lot, and your feedback contributes immensely.

    Best Regards,
    The 8Theme Team

  • Viewing 6 results - 1 through 6 (of 6 total)

The issue related to '‘this code is working for old theme which i had but with this new theme it is not working’' has been successfully resolved, and the topic is now closed for further responses

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.