Guest User

Untitled

a guest
Jun 6th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.19 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Simple product add to cart
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/simple.php.
  6.  *
  7.  * HOWEVER, on occasion WooCommerce will need to update template files and you
  8.  * (the theme developer) will need to copy the new files to your theme to
  9.  * maintain compatibility. We try to do this as little as possible, but it does
  10.  * happen. When this occurs the version of the template file will be bumped and
  11.  * the readme will list any important changes.
  12.  *
  13.  * @see         https://docs.woocommerce.com/document/template-structure/
  14.  * @author      WooThemes
  15.  * @package     WooCommerce/Templates
  16.  * @version     3.0.0
  17.  */
  18. if ( ! defined( 'ABSPATH' ) ) {
  19.     exit;
  20. }
  21.  
  22. global $product;
  23.  
  24. if ( ! $product->is_purchasable() ) {
  25.     return;
  26. }
  27.  
  28. echo wc_get_stock_html( $product );
  29.  
  30. if ( $product->is_in_stock() ) : ?>
  31.  
  32.     <?php do_action( 'woocommerce_before_add_to_cart_form' ); ?>
  33.  
  34.     <form class="cart" method="post" enctype='multipart/form-data'>
  35.         <?php
  36.             /**
  37.              * @since 2.1.0.
  38.              */
  39.             do_action( 'woocommerce_before_add_to_cart_button' );
  40.             echo do_shortcode("[woo_file_dropzone_product_detail_page]");
  41.  
  42.             /**
  43.              * @since 3.0.0.
  44.              */
  45.             do_action( 'woocommerce_before_add_to_cart_quantity' );
  46.  
  47.             woocommerce_quantity_input( array(
  48.                 'min_value'   => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),
  49.                 'max_value'   => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
  50.                 'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : $product->get_min_purchase_quantity(),
  51.             ) );
  52.  
  53.             /**
  54.              * @since 3.0.0.
  55.              */
  56.             do_action( 'woocommerce_after_add_to_cart_quantity' );
  57.         ?>
  58.  
  59.         <button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
  60.  
  61.         <?php
  62.             /**
  63.              * @since 2.1.0.
  64.              */
  65.             do_action( 'woocommerce_after_add_to_cart_button' );
  66.         ?>
  67.     </form>
  68.  
  69.     <?php do_action( 'woocommerce_after_add_to_cart_form' ); ?>
  70.  
  71. <?php endif; ?>
Add Comment
Please, Sign In to add comment