2011-12-12 11:35:54 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Loop Add to Cart
|
2012-08-14 18:05:45 +00:00
|
|
|
*
|
|
|
|
* @author WooThemes
|
|
|
|
* @package WooCommerce/Templates
|
2013-09-25 11:35:06 +00:00
|
|
|
* @version 2.1.0
|
2011-12-12 11:35:54 +00:00
|
|
|
*/
|
|
|
|
|
2014-09-22 16:31:03 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit; // Exit if accessed directly
|
|
|
|
}
|
2012-10-15 10:57:58 +00:00
|
|
|
|
2012-08-06 23:33:52 +00:00
|
|
|
global $product;
|
2011-12-12 11:35:54 +00:00
|
|
|
|
2013-09-25 11:35:06 +00:00
|
|
|
echo apply_filters( 'woocommerce_loop_add_to_cart_link',
|
2014-02-28 21:43:31 +00:00
|
|
|
sprintf( '<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button %s product_type_%s">%s</a>',
|
2013-09-25 11:35:06 +00:00
|
|
|
esc_url( $product->add_to_cart_url() ),
|
|
|
|
esc_attr( $product->id ),
|
2014-06-03 13:35:42 +00:00
|
|
|
esc_attr( $product->get_sku() ),
|
|
|
|
esc_attr( isset( $quantity ) ? $quantity : 1 ),
|
|
|
|
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
|
2013-09-25 11:35:06 +00:00
|
|
|
esc_attr( $product->product_type ),
|
|
|
|
esc_html( $product->add_to_cart_text() )
|
|
|
|
),
|
2014-01-10 02:38:05 +00:00
|
|
|
$product );
|