Skip to content

Instantly share code, notes, and snippets.

@dancameron
Last active October 16, 2019 17:59
Show Gist options
  • Save dancameron/e30ab76b69bab78cfbbcef61b917d300 to your computer and use it in GitHub Desktop.
Save dancameron/e30ab76b69bab78cfbbcef61b917d300 to your computer and use it in GitHub Desktop.
Set default values for line items
<?php // don't add this line since it's already in your functions.php file
function si_rate_default( $columns = array(), $type ) {
if ( '' != $type || 'default' != $type ) {
return $columns;
}
$columns['rate']['value'] = 125;
$columns['qty']['value'] = 1;
$columns['tax']['value'] = 0;
$columns['total']['value'] = 125;
return $columns;
}
add_filter( 'si_line_item_columns', 'si_rate_default', 10, 2 );
@dancameron
Copy link
Author

This snippet is a customization for Sprout Invoices. A customizable solution that provides a way for you to get paid via your WordPress site. For more information please don't hesitate to reach out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment