Skip to content

Instantly share code, notes, and snippets.

@wpcrmsystem
Created April 11, 2016 20:13
Show Gist options
  • Save wpcrmsystem/d2864dbd6da1ebda87ca3e9e5ed9f276 to your computer and use it in GitHub Desktop.
Save wpcrmsystem/d2864dbd6da1ebda87ca3e9e5ed9f276 to your computer and use it in GitHub Desktop.
Variables available to edit WP-CRM System Invoicing template.
$status //Returns 'not-paid' or 'paid'
$businessImage //Returns the URL to the image for your business set in WP-CRM System>Settings>Invoicing tab
$businessName //Returns the name of the business set in WP-CRM System>Settings>Invoicing tab
$businessAddress //Returns the address for the business set in WP-CRM System>Settings>Invoicing tab
$businessPhone //Returns the phone number for the business set in WP-CRM System>Settings>Invoicing tab
$businessEmail //Returns the email address for the business set in WP-CRM System>Settings>Invoicing tab
$businessURL //Returns the website URL for the business set in WP-CRM System>Settings>Invoicing tab
$numFields //Returns the number of line items for a specific invoice. Used to loop through each line. See for loop starting on line 124 of the default template.
for ( $x = 1; $x <= $numFields; $x++ ) {
$lineName[$x] //Returns the name of the product/service on a line item.
$linePrice[$x] //Returns the per unit price for the product/service for a line item.
$lineQty[$x] //Returns the quantity of the product/service for a line item.
$lineTotal[$x] //Returns the total line item price ($linePrice[$x] * $lineQty[$x])
$lineDesc[$x] = //Returns the description for a line item.
}
$invNum //Returns the invoice number
$poNum //Returns the Purchase Order number
$invDate //Returns the date of the invoice
$invDue //Returns the due date of the invoice
$invTerms //Returns the terms and conditions set for the invoice
$invNote //Returns the customer notes set for the invoice
$invOrg //Returns the ID of the organization set for the invoice. Used to retrieve an organization's information (name, address, etc.). See lines 45-65 of the default template.
$invContact //Returns the ID of the contact set for the invoice. Used to retrieve the contact's information (name, address, etc.). See lines 66-86 of the default template.
$invProject //Returns the ID of the project set for the invoice. Can be used similarly to the $invOrg and $invContact, however it is not used in the default template.
$invCurrency //Returns the currency set for the invoice as a three character code (i.e. usd, gbp, eur).
$displaySymbol //Returns the symbol of the currency set for the invoice (i.e. usd = $, gbp = £, etc.).
$disableStripe //Returns '' or 'yes' depending on whether or not Stripe can accept the selected currency for the invoice.
$invTax //Returns the value of tax set for the invoice. If this is not set on an invoice it will not return a value. Better to use $tax - see below.
$taxRate //Returns the global tax rate set in WP-CRM System>Settings>Invoicing tab
$numDecimals //Returns the number of decimals used to display currency in WP-CRM System>Settings
$decPt //Returns the decimal symbol used to display currency in WP-CRM System>Settings
$thousands //Returns the thousands separateor used to display currency in WP-CRM System>Settings
$stripePK //Returns the Publishable key for Stripe as set in WP-CRM System>Settings>Invoicing tab
$stripeSK //Returns the Secret key for Stripe as set in WP-CRM System>Settings>Invoicing tab
$stripeImg //Returns the image for Stripe as set in WP-CRM System>Settings>Invoicing tab
$alternatePayment //Returns the alternate payment instructions set in WP-CRM System>Settings>Invoicing tab
$subtotal //Returns the pre-tax total of the invoice (i.e. sum of all line item totals)
$tax //Returns the total tax to be charged. If $invTax is set in an invoice $tax = $invTax. If $invTax is not set for an invoice $tax = $subtotal * $taxRate.
$total //Returns the total price to be paid for the invoice (calculated $subtotal + $tax)
$stripeTotal //Returns the total price to be charged through Stripe in cents. If $total = $20.00, $stripeTotal = 2000.
wpcrm_system_invoicing_payments(); //Returns the payment section including Stripe "Pay with Card" button, and $alternatePayment information. For Stripe payments this will also display payment information such as "This payment has been processed" or "Sorry your card has been declined", and if an invoice is marked as paid it will return "This invoice has been marked as paid".
//To customize wpcrm_system_invoicing_payments(), you can copy the function towards the bottom of invoice-data.php into your theme's functions.php and edit it as much as you would like. Be sure to rename your function to avoid conflicts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment