• Resolved kambro

    (@kambro)


    Good midday,

    Thank you for this excellent plugin. No major problems encountered so far.
    Just an issue: the text of the price column is aligned to the left instead of the right hand. For that reason, the numbers are not aligned each on his raw.

    Best regards.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @kambro,

    Add this code snippet to your site to align the prices to the right:

    /**
     * Align the price to the right on PDF documents
     */
    add_action( 'wpo_wcpdf_custom_styles', function ( $document_type, $document ) {
    	?>
    	.price {
    		text-align: right;
    	}
    	<?php
    }, 10, 2 );

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Thread Starter kambro

    (@kambro)

    Thank you very much. It’s running perfect, except for the shipping costs line. Is there any way to put the name of the shipping type (in the example here, “via Point relais”) under the price line or next to the title “Expédition”?

    1000 x thanks in advance.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @kambro,

    Yes, there is! You can move the “shipped via” label to the next line, with this CSS rule, that you can add within the code snippet above, after the .price CSS rule:

    .shipped_via {
    	display: block;
    }

    If you prefer to hide it, use this CSS rule instead:

    .shipped_via {
    	display: none;
    }
    Thread Starter kambro

    (@kambro)

    Thank you one again for your answer.
    I’s quite perfect: just that the shipping coast is not aligned to the right.
    Excuse-me for my harassment.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    No problem! Try adding this extra CSS rule to align the total prices to the right:

    .totals .price {
        text-align: right;
    }

    If you prefer to apply this only to the shipping price, use this CSS rule instead:

    .totals .shipping .price {
        text-align: right;
    }
    Thread Starter kambro

    (@kambro)

    The problem comes, I think, from the fact that there is a space after the shipping price so that the shipping price numbers are shifted to the left.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Oh, I see. Please add this other code snippet to fix that:

    /**
     * Remove non-breaking spaces from total shipping value
     */
    add_filter( 'wpo_wcpdf_woocommerce_totals', function(  $totals, $order, $document_type ){
    	$totals['shipping']['value'] = str_replace( '&nbsp;', '', $totals['shipping']['value'] );	
    	return $totals;
    }, 10, 3 );
    Thread Starter kambro

    (@kambro)

    Thank you very much.
    It’s quite perfect.

    Suggestion: Wouldn’t it be nice if these presentation settings were built into your plugin by default?

    Plugin Contributor Ewout

    (@pomegranate)

    You already can, with our Premium Templates extension!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Text align in price column’ is closed to new replies.