41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Simple Product Add to Cart
|
|
*/
|
|
|
|
global $woocommerce, $_product;
|
|
|
|
if( $_product->get_price() === '') return;
|
|
?>
|
|
|
|
<?php
|
|
$availability = $_product->get_availability();
|
|
|
|
if ($availability['availability']) :
|
|
echo apply_filters( 'woocommerce_stock_html', '<p class="stock '.$availability['class'].'">'.$availability['availability'].'</p>', $availability['availability'] );
|
|
endif;
|
|
?>
|
|
|
|
<?php if (!$_product->is_in_stock()) : ?>
|
|
<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'); ?>
|
|
|
|
<form action="<?php echo esc_url( $_product->add_to_cart_url() ); ?>" class="cart" method="post" enctype='multipart/form-data'>
|
|
|
|
<?php do_action('woocommerce_before_add_to_cart_button'); ?>
|
|
|
|
<?php if (!$_product->is_downloadable()) woocommerce_quantity_input(); ?>
|
|
|
|
<button type="submit" class="button alt"><?php _e('Add to cart', 'woothemes'); ?></button>
|
|
|
|
<?php do_action('woocommerce_after_add_to_cart_button'); ?>
|
|
|
|
</form>
|
|
|
|
<?php do_action('woocommerce_after_add_to_cart_form'); ?>
|
|
|
|
<?php endif; ?>
|