I have a button that I've added to my product page, and I want to query the quantity in the woocommerce_quantity_input() control. For the life of me I can't find how to do that. I can get $product information, and $cart information, but I can't find how to get the quantity that is on this page (before I add it to the cart).
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $woocommerce;
?>
<div class="calculateshipping-button-container"
style="display:block;float:<?php echo $button_align_default; ?>;">
<div class="calculateshipping-button">
<div class="cs-btn" data-layout="button_count"
data-width="<?php echo $option_csbtn_width; ?>" data-show-faces="false">
<button type="button" class="shipping-calculator-button button"
id="showHideForm"><?php _e('Calculate Shipping', $this->app_name );?>
</button>
</div>
</div>
</div>
<?php
global $product;
global $quantity;
if(isset($_POST['calc_shipping']) && $_POST['calc_shipping'] == '1')
{
so I want to get the quantity next to the "Add To Cart Button"
and is added to the page with:
<?php do_action( 'woocommerce_before_shipping_calculator' ); ?>
<form class="shipping_calculator" action="" method="post">
with the "Calculate Button" defined as
<p><button type="submit" name="calc_shipping" value="1" class="button_shipping">
<?php _e( 'Calculate', 'woocommerce' ); ?></button></p>
qty
for selection via jquery or a name ofquantity
which then is available as a key in the$_POST
data. – helgatheviking