Created
March 23, 2021 19:55
-
-
Save kartikparmar/27ddd31c152c490d2c6654e8d8a7cd93 to your computer and use it in GitHub Desktop.
Show total and remaining amount on the front end product page.
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
| function bkap_appending_additional_information_to_price( $display_price, $wp_send_json ) { | |
| $total = $wp_send_json['total_price_calculated']; | |
| $price = $wp_send_json['bkap_price_charged']; | |
| if ( $total != $price ) { | |
| $wc_price_args = bkap_common::get_currency_args(); | |
| $remaining = $total - $price; | |
| $total_label = get_option( 'bkap_total_amt_label', '' ); | |
| $total_display = $total_label . wc_price( $total, $wc_price_args ) . '<br>'; // Total Price. | |
| $remaining_label = get_option( 'bkap_remaining_amt_label', '' ); | |
| $remaining_display = $remaining_label . wc_price( $remaining, $wc_price_args ); // Remaining Price. | |
| $display_price = $total_display . $display_price . '<br>' . $remaining_display; | |
| } | |
| return $display_price; | |
| } | |
| add_filter( 'bkap_appending_additional_information_to_price', 'bkap_appending_additional_information_to_price', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment