Array not reading argument in woocommerce_quantity_input
<p>I am trying to embed unit after quantity box in woocomerce. This can be easily achieved over at product page. To achieve that I have used post meta box and called it in woocommerce product display file ( wp-content\plugins\woocommerce\templates\global\quantity-input.php ) with following code.</p>

<pre><code>&lt;?php echo get_post_meta(get_the_ID(), 'wc_price_per_unit_key', true);?&gt;
</code></pre>

<p>Now I want to display it on cart page too. There it is not working because get_the_id() is not working there. So I tried to pass the post ID from cart.php page.</p>

<pre><code>$product_quantity = woocommerce_quantity_input( array(
                                'input_name'  =&gt; "cart[{$cart_item_key}][qty]",
                                'input_value' =&gt; $cart_item['quantity'],
                                'max_value'   =&gt; $_product-&gt;backorders_allowed() ? '' : $_product-&gt;get_stock_quantity(),
                                'min_value'   =&gt; '0',
                                'id'          =&gt; $product_id,   
                            ), $_product, false );
</code></pre>

<p>And I added <code>id</code> element in <code>woocommerce_quantity_input</code> by this code.</p>

<pre><code>function woocommerce_quantity_input( $args = array(), $product = null, $echo = true ) {
    if ( is_null( $product ) ) {
        $product = $GLOBALS['product'];
    }

    $defaults = array(
        'input_name'    =&gt; 'quantity',
        'input_value'   =&gt; '1',
        'max_value'     =&gt; apply_filters( 'woocommerce_quantity_input_max', '', $product ),
        'min_value'     =&gt; apply_filters( 'woocommerce_quantity_input_min', '', $product ),
        'step'          =&gt; apply_filters( 'woocommerce_quantity_input_step', '1', $product ),
        'id'            =&gt; '1'
    );
    if ( is_null ( $args['id'] ) ) {            
        echo 'asd';
    }
</code></pre>

<p>In last I <code>echo 'asd'</code> to check that <code>id</code> argument is coming in <code>woocommerce_quantity_input</code> function but <code>asd</code> printed proving that array is not reading the element.</p>

<p><b>Solution Found</b><br>
I was editing cart.php file that was in <code>wp-content\plugins\woocommerce\templates\cart</code> it was being mirrored by <code>\wp-content\themes\testing\woocommerce\cart</code>. After editing right cart file problem solved.</p>

<p><b>New Issue</b><br>
Can anyone guide me how to achieve this in custom plugin approach. That is the hardcode editing that I am doing in woocomerce files. Is it possible via any filter to place code in cart.php file and so on.</p>