Last active
October 29, 2019 19:12
-
-
Save BFTrick/88189f4fc5924ed5f4f074ea8b193482 to your computer and use it in GitHub Desktop.
Add a Call to order button on the product archive page(s) (Shop 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 | |
function patricks_woocommerce_call_to_order_button(){ | |
global $product; //get the product object | |
if ( $product ) { // if there's a product proceed | |
$url = esc_url( $product->get_permalink() ); //get the permalink to the product | |
echo '<a rel="nofollow" href="' . $url . '" class="button add_to_cart_button ">Call to order!</a>'; //display a button that goes to the product page | |
} | |
} | |
add_action('woocommerce_after_shop_loop_item','patricks_woocommerce_call_to_order_button', 10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment