Title: wooscp_button_html
Last modified: April 13, 2021

---

# wooscp_button_html

 *  [adam198](https://wordpress.org/support/users/adam198/)
 * (@adam198)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wooscp_button_html/)
 * In the log it says you have added Filter for button html ‘wooscp_button_html’
   but could you explain how it can be used. I have been trying to play around with
   it without success.
 * Thanks

Viewing 1 replies (of 1 total)

 *  [miemie](https://wordpress.org/support/users/miemie/)
 * (@miemie)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wooscp_button_html/#post-14329670)
 * Hi [@adam198](https://wordpress.org/support/users/adam198/),
    You can add below
   snippet to current-theme (or child-theme) / functions.php:
 *     ```
       add_filter( 'wooscp_button_html', 'wooscp_custom_button_html', 99, 2 );
       function wooscp_custom_button_html( $html, $product_id ) {
       	$button_text = get_option( '_wooscp_button_text' );
   
       	if ( empty( $button_text ) ) {
       		$button_text = esc_html__( 'Compare', 'wooscp' );
       	}
   
       	// change the link as you want here
       	return '<a href="#" class="woosc-btn wooscp-btn wooscp-btn-' . esc_attr( $product_id ) . ' ' . get_option( '_wooscp_button_class' ) . '" data-id="' . esc_attr( $product_id ) . '">' . esc_html( $button_text ) . '</a>';
       }
       ```
   
    -  This reply was modified 5 years, 1 month ago by [miemie](https://wordpress.org/support/users/miemie/).
    -  This reply was modified 5 years, 1 month ago by [miemie](https://wordpress.org/support/users/miemie/).
    -  This reply was modified 5 years, 1 month ago by [miemie](https://wordpress.org/support/users/miemie/).
    -  This reply was modified 5 years, 1 month ago by [miemie](https://wordpress.org/support/users/miemie/).

Viewing 1 replies (of 1 total)

The topic ‘wooscp_button_html’ is closed to new replies.

 * ![](https://ps.w.org/woo-smart-compare/assets/icon-128x128.png?rev=1858171)
 * [WPC Smart Compare for WooCommerce](https://wordpress.org/plugins/woo-smart-compare/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-smart-compare/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-smart-compare/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-smart-compare/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-smart-compare/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-smart-compare/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [miemie](https://wordpress.org/support/users/miemie/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/wooscp_button_html/#post-14329670)
 * Status: not resolved