Created
August 26, 2017 06:07
-
-
Save wpexplorer/c935f730f1d89c4d3acfb72d3baddaf7 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
// Change button on all external product links | |
add_filter( 'woocommerce_loop_add_to_cart_link', function( $html, $product ) { | |
if ( 'external' === $product->get_type() ) { | |
$html = '<a href="' . esc_url( get_permalink() ) . '/#inquire" class="button">Inquire</a>'; | |
} | |
return $html; | |
}, 10, 2 ); | |
// Add custom inquire button to all external product pages | |
add_action( 'woocommerce_single_product_summary', function() { | |
global $product; | |
if ( 'external' === $product->get_type() ) { | |
echo '<a href="#inquire" class="button local-scroll-link">Inquire</a>'; | |
} | |
}, 30 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment