Created
March 7, 2014 19:21
-
-
Save raphaelchaib/9418049 to your computer and use it in GitHub Desktop.
WooCommerce: Change add_to_cart button to "Read More" button
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
| <?php | |
| remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); | |
| add_action( 'woocommerce_after_shop_loop_item', 'cg_loop_add_to_cart', 10 ); | |
| function cg_loop_add_to_cart() { | |
| // global $product; | |
| // echo '<form action="' . esc_url( get_permalink( $product->id ) ) . '" method="get"> | |
| // <button type="submit" class="single_add_to_cart_button button alt">View More</button> | |
| // </form>'; | |
| global $product; // this may not be necessary as it should have pulled the object in already | |
| echo '<a href="' . esc_url( get_permalink( $product->id ) ) . '" class="single_add_to_cart_button button alt">Read More</a>'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment