Tooltip for the “Fee name” field
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
add_filter( 'woocommerce_cart_totals_fee_html', function( $cart_totals_fee_html, $fee ) { return '<span class="woocommerce-help-tip" data-tip="The text you would love to see"></span>' . $cart_totals_fee_html; }, 10, 2 ); add_action( 'wp_footer', function() { if ( is_cart() || is_checkout() ) { ?> <script> jQuery( document ).ready( function() { jQuery( ".woocommerce-help-tip" ).tipTip( { 'attribute': 'data-tip', 'fadeIn': 50, 'fadeOut': 50, 'delay': 200, 'keepAlive': true } ).focus(); }); </script> <?php } }, 25 ); add_action( 'wp_enqueue_scripts', function() { if ( is_cart() || is_checkout() ) { $suffix = Automattic\Jetpack\Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min'; $version = Automattic\Jetpack\Constants::get_constant( 'WC_VERSION' ); wp_enqueue_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), $version ); wp_enqueue_script( 'jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), $version, true ); } }); |