Function Reference: geodir_payment_invoice_id_formatted

Summary

Get the customized invoice id to display.

Parameters

$invoice_id
(int) (required) The invoice id.

Default: None

Return Values

(int|string)
  • Custom invoice id.

Change Log

Since: 1.3.6

Filters

‘geodir_payment_invoice_id_formatted’ [Line: 5165]

Source Code

function geodir_payment_invoice_id_formatted($invoice_id) {
	$threshold = absint(get_option('geodir_payment_invoice_threshold'));
	$threshold = $threshold > 20 ? 20 : $threshold;
	
	$prefix = get_option('geodir_payment_invoice_prefix');
	
	$custom_invoice_id = substr($prefix, 0, 10) . zeroise($invoice_id, $threshold);
	/**
	 * Filter the invoice id to display customized invoice id.
	 *
	 * @since 1.3.6
	 *
	 * @param string $custom_invoice_id The custom invoice id.
	 * @param int $invoice_id The invoice id.
	 */
	 $custom_invoice_id = apply_filters('geodir_payment_invoice_id_formatted', $custom_invoice_id, $invoice_id);
	
	return $custom_invoice_id;
}