[2.5] Qty button can be hidden for variables sold individually

This commit is contained in:
Mike Jolley 2016-01-22 17:53:09 +00:00
parent f5140af918
commit 8093194a44
1 changed files with 3 additions and 1 deletions

View File

@ -14,7 +14,9 @@ if ( ! defined( 'ABSPATH' ) ) {
global $product;
?>
<div class="woocommerce-variation-add-to-cart variations_button">
<?php woocommerce_quantity_input( array( 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : 1 ) ); ?>
<?php if ( ! $product->is_sold_individually() ) : ?>
<?php woocommerce_quantity_input( array( 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : 1 ) ); ?>
<?php endif; ?>
<button type="submit" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
<input type="hidden" name="add-to-cart" value="<?php echo absint( $product->id ); ?>" />
<input type="hidden" name="product_id" value="<?php echo absint( $product->id ); ?>" />