2011-12-09 19:55:09 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Simple Product Add to Cart
|
|
|
|
*/
|
|
|
|
|
2011-12-11 14:40:25 +00:00
|
|
|
global $woocommerce, $product;
|
2011-12-09 19:55:09 +00:00
|
|
|
|
2011-12-11 14:40:25 +00:00
|
|
|
if( $product->get_price() === '') return;
|
2011-12-09 19:55:09 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<?php
|
2012-01-14 17:59:47 +00:00
|
|
|
// Availability
|
2011-12-11 14:40:25 +00:00
|
|
|
$availability = $product->get_availability();
|
2011-12-09 19:55:09 +00:00
|
|
|
|
|
|
|
if ($availability['availability']) :
|
|
|
|
echo apply_filters( 'woocommerce_stock_html', '<p class="stock '.$availability['class'].'">'.$availability['availability'].'</p>', $availability['availability'] );
|
|
|
|
endif;
|
|
|
|
?>
|
|
|
|
|
2011-12-11 14:40:25 +00:00
|
|
|
<?php if (!$product->is_in_stock()) : ?>
|
2011-12-09 19:55:09 +00:00
|
|
|
<link itemprop="availability" href="http://schema.org/OutOfStock">
|
|
|
|
<?php else : ?>
|
|
|
|
|
|
|
|
<link itemprop="availability" href="http://schema.org/InStock">
|
|
|
|
|
|
|
|
<?php do_action('woocommerce_before_add_to_cart_form'); ?>
|
|
|
|
|
2011-12-11 14:40:25 +00:00
|
|
|
<form action="<?php echo esc_url( $product->add_to_cart_url() ); ?>" class="cart" method="post" enctype='multipart/form-data'>
|
2011-12-09 19:55:09 +00:00
|
|
|
|
|
|
|
<?php do_action('woocommerce_before_add_to_cart_button'); ?>
|
|
|
|
|
2012-01-14 17:59:47 +00:00
|
|
|
<?php
|
|
|
|
if (!$product->is_downloadable())
|
|
|
|
woocommerce_quantity_input( array( 'max_value' => ($product->backorders_allowed()) ? '' : $product->get_stock_quantity() ) );
|
|
|
|
?>
|
2011-12-09 19:55:09 +00:00
|
|
|
|
2012-01-05 11:31:22 +00:00
|
|
|
<button type="submit" class="button alt"><?php _e('Add to cart', 'woocommerce'); ?></button>
|
2011-12-09 19:55:09 +00:00
|
|
|
|
|
|
|
<?php do_action('woocommerce_after_add_to_cart_button'); ?>
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<?php do_action('woocommerce_after_add_to_cart_form'); ?>
|
|
|
|
|
|
|
|
<?php endif; ?>
|