• Hi,

    I want to change the button HTML but I am struggling with it. I really only want to add a title to the button/link tag with the button_text as the value.

    I understand I can use wooscp_button_html filter but I am not sure what to replace it with. If I use the wooscp_shortcode function then edit the output I will get undefined variables.

    Is what I want to do possible?

Viewing 1 replies (of 1 total)
  • Plugin Author WPClever

    (@wpclever)

    Hi @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>';
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Change the Button HTML’ is closed to new replies.