/templates/single-product/add-to-cart/variation-add-to-cart-button.php

  1. <?php 
  2. /** 
  3. * Single variation cart button 
  4. * 
  5. * @see https://docs.woocommerce.com/document/template-structure/ 
  6. * @author WooThemes 
  7. * @package WooCommerce/Templates 
  8. * @version 3.0.0 
  9. */ 
  10. if ( ! defined( 'ABSPATH' ) ) { 
  11. exit; 
  12.  
  13. global $product; 
  14. ?> 
  15. <div class="woocommerce-variation-add-to-cart variations_button"> 
  16. <?php 
  17. /** 
  18. * @since 3.0.0. 
  19. */ 
  20. do_action( 'woocommerce_before_add_to_cart_quantity' ); 
  21.  
  22. woocommerce_quantity_input( array( 
  23. 'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),  
  24. 'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),  
  25. 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : $product->get_min_purchase_quantity(),  
  26. ) ); 
  27.  
  28. /** 
  29. * @since 3.0.0. 
  30. */ 
  31. do_action( 'woocommerce_after_add_to_cart_quantity' ); 
  32. ?> 
  33. <button type="submit" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button> 
  34. <input type="hidden" name="add-to-cart" value="<?php echo absint( $product->get_id() ); ?>" /> 
  35. <input type="hidden" name="product_id" value="<?php echo absint( $product->get_id() ); ?>" /> 
  36. <input type="hidden" name="variation_id" class="variation_id" value="0" /> 
  37. </div> 
.