Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #2287945
SVG Button
Closed

Comments

  • Alexey started the conversation

    Hi. Can you tell the best way to change button view? I know that I can change the look with css, but what if I need to make an svg animation. For example: https://codepen.io/codyogden/pen/GMEXNm

    I can change it inside of the "index.php" file with this lines:

    if ( $atts['type'] === 'link' ) {
        $output = '<a href="#" class="' . esc_attr( $woosw_class ) . '" data-id="' . esc_attr( $atts['id'] ) . '">' . esc_html( $woosw_text ) . '</a>';
    } else {
        $output = '<button class="' . esc_attr( $woosw_class ) . '" data-id="' . esc_attr( $atts['id'] ) . '">' . esc_html( $woosw_text ) . '</button>';
    }
    But, can you tell me, if I can change it with Hooks? Or maybe there is a better way, without changing core file? Thank you!

  •  1,226
    Dustin replied

    Hi Alexey,

    This is a nice button but currently, too difficult to add this SVG button to our plugin code.

    You can try the filter hook woosw_button_html by adding below function to current theme (or child-theme) / functions.php:

    add_filter( 'woosw_button_html', 'svg_woosw_button_html', 99, 2 );
    function svg_woosw_button_html( $button, $product_id ) {
       $output = '<span class="woosw-btn woosw-btn-' . $product_id . '" data-id="' . $product_id . '">';
       $output .= 'your-svg-code-here';
       $output .= '</span>';
       return $output;
    }

    We'll try to add more hooks for customers easy change the button interface soon.

    Best regards,
    Dustin

  • Alexey replied

    Thanks a lot! But is it possible do not change a code inside of span when it was added to wish list? Svg code is replaced by "Browse wishlist" label.

  •  1,226
    Dustin replied

    You can do that by editing the JS file woo-smart-wishlist/assets/js/frontend.js

    Please find below code and remove it.

    if (response['status'] == 1) {
      _this.addClass('woosw-added').html(woosw_vars.button_text_added);
    }

    Best regards,
    Dustin