Created
February 5, 2016 12:36
-
-
Save acanza/188ee0347efaa7800032 to your computer and use it in GitHub Desktop.
Modifica el estilo del shortcode del botón de compra.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_loop_add_to_cart_link', 'apply_add_to_cart_shop_style' ); | |
function apply_add_to_cart_shop_style(){ | |
global $product; | |
if( !is_shop() && !is_product() ){ | |
echo sprintf( '<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="%s_%s button alt">%s</a>', | |
esc_url( $product->add_to_cart_url() ), | |
esc_attr( $product->id ), | |
esc_attr( $product->get_sku() ), | |
esc_attr( isset( $quantity ) ? $quantity : 1 ), | |
esc_attr( $product->product_type ), | |
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', | |
esc_html( $product->add_to_cart_text() ) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment