• Resolved dynadubedesign

    (@dynadubedesign)


    Hi,

    Can’t increase quantity of a product that allows backorders with the “+” button <button type=”button” class=”cclwplus”>+</button> only if I write in the input field it will change the quantity.

    This will be very confusing for the users/costumer or if the user don’t know it is a input field for the quantity.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Rupinder Kaur

    (@coolcoders)

    Okay , i will look into this.

    Thread Starter dynadubedesign

    (@dynadubedesign)

    Any update on this?

    Thank for a amazing plugin!

    Thread Starter dynadubedesign

    (@dynadubedesign)

    in custom-checkout-layouts-for-woocommerce.2.0\custom-checkout-layouts-for-woocommerce\WooCommerce\cart\cart.php

    you have a ‘max_value’ => $_product->get_max_purchase_quantity(),
    and you could use a if() statement with WC_Product::backorders_allowed(); that could be used to solve this problem or correct me if i’m wrong?

    						<td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'woocommerce' ); ?>"><?php
    							if ( $_product->is_sold_individually() ) {
    								$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
    							} else {
    								$product_quantity = woocommerce_quantity_input( array(
    									'input_name'   => "cart[{$cart_item_key}][qty]",
    									'input_value'  => $cart_item['quantity'],
    									'max_value'    => $_product->get_max_purchase_quantity(),
    									'min_value'    => '0',
    									'product_name' => $_product->get_name(),
    								), $_product, false );
    							}
    Thread Starter dynadubedesign

    (@dynadubedesign)

    Found the solution that I think works fine now:

    In custom-checkout-layouts-for-woocommerce.2.0\custom-checkout-layouts-for-woocommerce\WooCommerce\cclw_checkout\orderreview-table.php

    <input type="number" id="qty1" class="input-text qty text" step="1" min="1" max="<?php echo $_product->get_stock_quantity();?>" name="cart[<?php echo $cart_item_key; ?>][qty]" value="<?php echo $cart_item['quantity'];?>" title="Qty" size="4" inputmode="numeric">

    I changed the code to

    			<?php
    			if( $_product->backorders_allowed() ) {
    				$allow_backorder = '';
    			}else{
    				$allow_backorder = $_product->get_stock_quantity();	
    			}
    			?>
    			<input type="number" id="qty1" class="input-text qty text" step="1" min="1" max="<?php echo $allow_backorder;?>" name="cart[<?php echo $cart_item_key; ?>][qty]" value="<?php echo $cart_item['quantity'];?>" title="Qty" size="4" inputmode="numeric">
    Plugin Author Rupinder Kaur

    (@coolcoders)

    Hi @dynadubedesign

    Yes, the solution works as per your requirement. But yes I have to work around it for the next update. Because when the product is sold individually, I need to add a condition for this too.

    Thanks for sharing your solution. I will definitely add it in the next update.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Increase quantity of product of allowed backorders’ is closed to new replies.