• Resolved iamirfanzafar

    (@iamirfanzafar)


    I am having a issue related to stock status. I have added a function to show stock status with my own messages but I need to appear stock status below the add to basket button. Right now it is above the add to basket button.
    I have tried with Elementor widget “Product stock” and it appears below the add to basket button that is exactly what I need but problem is both stock status appears that is stock status with elementor and stock status with function. If I removed function then both disappear.
    Is there any way to placed it below the add to basket using hook?
    Here is function
    /**
    * WooCommerce Display Stock Availablity
    */

    add_filter( ‘woocommerce_get_availability’, ‘stock_availability’, 1, 2);

    function stock_availability( $availability, $_product ) {

    global $product;

    // Change In Stock Text
    if ( $_product->is_in_stock() ) {
    $availability[‘availability’] = __(‘Availability : In Stock’, ‘woocommerce’);
    }

    // Change Out of Stock Text
    if ( ! $_product->is_in_stock() ) {
    $availability[‘availability’] = __(‘Product sold out’, ‘woocommerce’);
    }

    return $availability;
    }

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Stock status postion issue on single product page’ is closed to new replies.