• Resolved Jason Wong

    (@eljkmw)


    There are 3 rows of code within /woocommerce/includes/abstracts/abstract-wc-order.php in the get_shipping_to_display function, which has this &nbsp;<small class="tax_label">.

    The &nbsp; is causing an unremovable space (shown as a red rectangle here) between the shipping method price and the right edge of the table. I wanna get rid of it, or replace it with <br>. Either way, I hope to avoid hacking into WooCommerce‘s core through a filter/hook, but I can’t figure out how to achieve that.

    Please help. Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Jason Wong

    (@eljkmw)

    Silly me … The solution came to mind a while ago.

    // Replace space before displaying the shipping method with <br>
    function wc_remove_space_before_shipping_method( $shipping ) {
    	$shipping = str_replace( '&nbsp;<small', '<br><small', $shipping );
    	return $shipping;
    }
    add_filter( 'woocommerce_order_shipping_to_display', 'wc_remove_space_before_shipping_method', 10, 2 );

    Although it works, the replaced space turns to double line breaks. Why?
    Suggestions welcome. (^_^)v

    Thread Starter Jason Wong

    (@eljkmw)

    Argh! Just found out that the snippet was alright all along.
    It was an earlier translation that I added a <br> before <small class="tax_label">, which was still cached in the web browser. After a few refreshes, it cleared.

    Yahoo! It works at last … *\(^_^)/*

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to remove _ before _[small class="tax_label"]’ is closed to new replies.