• Resolved siemwagemans

    (@siemwagemans)


    Hi, I’m selling subscriptions through woocommerce supscriptions and I was wondering if there’s a way to add “/ month” after the price on the invoice PDF?

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

    (@pomegranate)

    I may be able to help achieve this with some custom code, but I need a bit more details:

    • By ‘price’, are you referring to the total price on the invoice, or the line price?
    • Is this for subscription products or subscription orders?
    Thread Starter siemwagemans

    (@siemwagemans)

    Hi Ewout, thanks for your quick respond.
    I wanted to add “/ month” after the “price” text on the invoices.
    I’m relatively new to editing but I actually just managed to add “/ month” after the “price” text in the invoice.php file (I found this file under templates – Simple).
    The invoice is displaying as desired now.

    However, will these changes still stay permanent when updating the plugin to a newer version in the future?

    Plugin Contributor Ewout

    (@pomegranate)

    Glad to hear you already found a way to do this! If you’re making changes to the template you should copy the files to your child theme. More information in our docs: Creating a custom PDF template

    Thread Starter siemwagemans

    (@siemwagemans)

    I’d actually prefer to achieve this with custom CSS in the WordPress customizer or by adding code to the code snippets plugin (instead of copying files to the child theme). Is this possible?

    • This reply was modified 6 years, 6 months ago by siemwagemans.
    Plugin Contributor Ewout

    (@pomegranate)

    The WordPress customizer is only for the Theme on your site, not for the PDF invoices. But you can add CSS with a small code snippet indeed:
    Using custom styles

    You can inspect the HTML source that is used for the PDF by temporarily enabling HTML output in the Status tab of the plugin settings, so that you can see exactly which selectors you have available.

    If you want a fully non-coding solution to changing the column headers you could also use our Premium Templates extension for that purpose.

    Thread Starter siemwagemans

    (@siemwagemans)

    Thank you Ewout,
    I inspected the HTML source like you said and discovered that I need to change the way price is displayed in <th class=”price”>price</th> to <th class=”price”>price / month</th>

    Could you give me the CSS snippet I need to add in order to achieve this?
    I want to learn how to write my own code, but as mentioned earlier I dont have much experience with creating my own codes yet.
    I hope you can help me out with this.

    Plugin Contributor kluver

    (@kluver)

    Hi @siemwagemans,

    You can achieve this with a code snippet that will add some CSS to your invoice template:

    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles' );
    function wpo_wcpdf_custom_styles () {
    	?>
    	.invoice th.price::after {
    		content: " / month";
    	}
    	<?php
    }

    This code snippet should be added to the functions.php of your child theme or with a plugin like Code Snippets. If you haven’t worked with code snippets or functions.php before please read this: How to use filters

    Please note the above snippet will only add the additional text to the invoice. If you want this to apply to all documents you will have to omit the .invoice.

    Thread Starter siemwagemans

    (@siemwagemans)

    Hi @kluver,

    That was exactly what I needed!
    Thank you very much!!

    Thread Starter siemwagemans

    (@siemwagemans)

    @kluver do you also have a code snippet to add customer’s order notes (from the checkout field) to the invoice? The name of the field is billing_order_notes
    Thanks in advance

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Show price per month’ is closed to new replies.