Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function king_replace_loop_add_to_cart_button( $button, $product ){
- // Not needed for variable products
- if( $product->is_type( 'variable' ) )
- return $button;
- if ( is_shop() && $product->is_purchasable() && $product->is_in_stock() ){
- // Button text here
- $button_text = __( "View product", "woocommerce" );
- return '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>';
- }
- }
- add_filter( 'woocommerce_loop_add_to_cart_link', 'king_replace_loop_add_to_cart_button', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement