Created
April 13, 2015 05:27
-
-
Save BurlesonBrad/0d023f814022184f6491 to your computer and use it in GitHub Desktop.
Modified quantity added to themes/theonepager-child/woocommerce/checkout/add-to-cart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Product quantity input | |
* | |
* Extends the WooCommerce quantity input template to include the add_to_cart data attribute. | |
* | |
* @package WooCommerce-One-Page-Checkout/Templates | |
* @version 1.0 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly | |
} | |
$input_button = woocommerce_quantity_input( array( | |
'input_name' => 'product_id', | |
'input_value' => ! empty( $product->cart_item['quantity'] ) ? $product->cart_item['quantity'] : 1, | |
'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity(), | |
'min_value' => 1, | |
), $product, false ); | |
echo str_replace( 'type="number"', 'type="number" data-add_to_cart="' . $product->add_to_cart_id . '"', $input_button ); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment