Add max-value to hooked quantity selector in woocommerce [closed]

function max_quantity_single( $max, $product ) {
    $stock = get_post_meta( get_the_ID(), '_stock', true );
    $max = $stock;  
    return $max;
}
add_filter( 'woocommerce_quantity_input_max','max_quantity_single', 10, 2 );

Add this hook in your functions.php or plugin file.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)