Created
January 24, 2023 13:36
-
-
Save PluginRepublicSupport/2911aab4e01dbc65a53941af0cda1b5d to your computer and use it in GitHub Desktop.
Disable add-to-cart on WooCommerce shop/archive page
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
<?php | |
/** | |
* Disable the add to cart action | |
*/ | |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); | |
/** | |
* Redirect to product page | |
*/ | |
add_action( 'woocommerce_after_shop_loop_item', 'shop_more_info_button', 10 ); | |
function shop_more_info_button() { | |
global $product; | |
$link = $product->get_permalink(); | |
echo '<a href="' . $link . '" class="button wp-element-button product_type_simple">More Info</a>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment