Created
April 18, 2018 12:27
-
-
Save codersaiful/035142af85f17ab9b55a16053123971a to your computer and use it in GitHub Desktop.
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
/** | |
* Changing add to cart link with custom Text | |
* @author Saiful Islam | |
* | |
* @global type $product getting Global Product variable for getting permalink | |
* @return String Add to cart button link change | |
*/ | |
function sfl_woocommerce_custom_add_to_cart_link_for_shop(){ | |
global $product; | |
$data = $product->get_data(); | |
$product_permalink = get_the_permalink($data['id']); | |
return '<a class="button your_button_class" href="'. $product_permalink .'">Details Text</a>'; | |
} | |
add_filter('woocommerce_loop_add_to_cart_link','sfl_woocommerce_custom_add_to_cart_link_for_shop'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment