Created
October 17, 2019 15:29
-
-
Save dancameron/f21246f901203e9bcfcd3c03e7a2ada1 to your computer and use it in GitHub Desktop.
Default Line Items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php // don't include this line in your functions.php, since it already starts with it. | |
| function set_line_item_defaults( $columns = array(), $type ) { | |
| if ( 'service' !== $type ) { | |
| return $columns; | |
| } | |
| $columns['desc']['value'] = 'This is the default text'; | |
| $columns['rate']['value'] = 125; | |
| $columns['tax']['value'] = 0; | |
| $columns['total']['value'] = 125; | |
| return $columns; | |
| } | |
| add_filter( 'si_line_item_columns', 'set_line_item_defaults', 10, 2 ); | |
| function _set_default_line_item_type( $old_default ) { | |
| return 'service'; | |
| } | |
| add_filter( 'si_get_default_line_item_type', '_set_default_line_item_type' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment