Skip to content

Instantly share code, notes, and snippets.

@wpexplorer
Created August 26, 2017 06:07
Show Gist options
  • Save wpexplorer/c935f730f1d89c4d3acfb72d3baddaf7 to your computer and use it in GitHub Desktop.
Save wpexplorer/c935f730f1d89c4d3acfb72d3baddaf7 to your computer and use it in GitHub Desktop.
// 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