Skip to content

Instantly share code, notes, and snippets.

@eltondev
Created August 18, 2016 19:40
Show Gist options
  • Save eltondev/3ef50f93fbdf43beec9d9f1c6d073fa6 to your computer and use it in GitHub Desktop.
Save eltondev/3ef50f93fbdf43beec9d9f1c6d073fa6 to your computer and use it in GitHub Desktop.
Add button to buy the product grid WooCommerce
//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