Created
August 18, 2016 19:40
-
-
Save eltondev/3ef50f93fbdf43beec9d9f1c6d073fa6 to your computer and use it in GitHub Desktop.
Add button to buy the product grid WooCommerce
This file contains hidden or 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 button to buy the product grid WooCommerce | |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); | |
add_action( 'woocommerce_after_shop_loop_item', 'my_woocommerce_template_loop_add_to_cart', 10 ); | |
function my_woocommerce_loop_add_to_cart() | |
{ | |
global $product; | |
echo '<form action="' . esc_url( $product->get_permalink( $product->id ) ) . '" method="get"> | |
<button type="submit" class="single_add_to_cart_button button alt">' . __('Comprar', 'woocommerce') . '</button> | |
</form>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment