daily pastebin goal
41%
SHARE
TWEET

variation-add-to-cart-button.php

a guest Jan 29th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  14. global $product;
  15. ?>
  16. <div class="woocommerce-variation-add-to-cart variations_button">
  17.     <?php
  18.         /**
  19.          * @since 3.0.0.
  20.          */
  21.         do_action( 'woocommerce_before_add_to_cart_quantity' );
  22.  
  23.         woocommerce_quantity_input( array(
  24.             'min_value'   => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),
  25.             'max_value'   => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
  26.             'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : $product->get_min_purchase_quantity(),
  27.         ) );
  28.  
  29.         /**
  30.          * @since 3.0.0.
  31.          */
  32.         do_action( 'woocommerce_after_add_to_cart_quantity' );
  33.     ?>
  34.     <button type="submit" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
  35.     <input type="hidden" name="add-to-cart" value="<?php echo absint( $product->get_id() ); ?>" />
  36.     <input type="hidden" name="product_id" value="<?php echo absint( $product->get_id() ); ?>" />
  37.     <input type="hidden" name="variation_id" class="variation_id" value="0" />
  38. </div>
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top