Last active
July 1, 2019 07:30
-
-
Save MjHead/90f529b822cc636244c0171090932358 to your computer and use it in GitHub Desktop.
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 | |
| add_filter( 'jet-engine/listings/allowed-callbacks', 'jet_he_add_calc_callback', 10, 2 ); | |
| function jet_he_add_calc_callback( $callbacks ) { | |
| $callbacks['jet_he_calc_fileds'] = 'Calculated total price'; | |
| $callbacks['jet_he_calc_fileds_no_discount'] = 'Calculated total price (without discount)'; | |
| return $callbacks; | |
| } | |
| function jet_he_calc_fileds( $field_1_value ) { | |
| $license_fee = absint( get_post_meta( get_the_ID(), 'license-fee', true ) ); | |
| $discount = absint( get_post_meta( get_the_ID(), 'discount', true ) ); | |
| return $field_1_value + $license_fee - $discount; | |
| } | |
| function jet_he_calc_fileds_no_discount( $field_1_value ) { | |
| $license_fee = absint( get_post_meta( get_the_ID(), 'license-fee', true ) ); | |
| return $field_1_value + $license_fee; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment