function woocommerce_template_loop_add_to_cart()
 {
     global $product;
     if ($product->product_type == "variable") {
         woocommerce_variable_add_to_cart();
     } else {
         woocommerce_get_template('loop/add-to-cart.php');
     }
 }
 function woocommerce_template_loop_add_to_cart()
 {
     global $product;
     if ($product) {
         $defaults = array('quantity' => 1, 'class' => implode(' ', array_filter(array('button', 'product_type_' . $product->product_type, $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', $product->supports('ajax_add_to_cart') ? 'ajax_add_to_cart' : ''))));
         $args = apply_filters('woocommerce_loop_add_to_cart_args', wp_parse_args($args, $defaults), $product);
         if ($product->product_type == "variable") {
             woocommerce_variable_add_to_cart();
         } else {
             wc_get_template('loop/add-to-cart.php', $args);
         }
     }
 }
				<?php 
echo $product->get_price();
?>
			</span>
		</div>

	</div>

	<?php 
if ($product->product_type == 'variable') {
    ?>

		<div class="variations">

			<?php 
    woocommerce_variable_add_to_cart();
    ?>

		</div>

	<?php 
} else {
    ?>

		<button class="add-to-cart" data-url="<?php 
    echo $product->add_to_cart_url();
    ?>
">
			Add To Cart
		</button>
Exemple #4
0
function customize_cart_button()
{
    global $product;
    woocommerce_variable_add_to_cart();
}
function todo()
{
    ?>
  		
  			<div class="container">
             <div class="col-md-4 col-xs-6 prod-img">
               <img src="<?php 
    img();
    ?>
" style="width:250px;height:250px;">
             </div>
             <div class="col-md-4 col-xs-12 prod-des">
               <h4><?php 
    the_title();
    ?>
</h4>     
               <h3><?php 
    the_content();
    ?>
</h3> 
              <p class="stock"><?php 
    my_stock();
    ?>
</p>
              <p class="cart"><?php 
    woocommerce_variable_add_to_cart();
    ?>
</p> 
              <p class="info"><?php 
    woocommerce_product_additional_information_tab();
    ?>
</p>

             </div>
             <div class="col-md-4 col-xs-12 prod-cot">
              <a href="<?php 
    bloginfo('url');
    ?>
/contacto?cto=<?php 
    the_title();
    ?>
" class='btn-cot'><span>PEDIR COTIZACIÓN</span></a>
             </div>
           </div>
            
   <?php 
}