-1

从这个 php 脚本。我愿意在最后给总价加上 10% 的折扣。请帮助我,我不知道为什么如何在这个插件中添加折扣功能

// Calculate Total Price
$total_price = $book_room_price * $total_stay;

// Get currency unit stored in the theme options
if ( $data['currency_unit'] !== '' ) {
    $currency_unit = $data['currency_unit'];
4

2 回答 2

1
// Calculate Total Price
$discount = 10;
$total_price = $book_room_price * $total_stay;
$discounted_total = $total_price - ($total_price * ($discount/100)); 

 // Get currency unit stored in the theme options
if ( $data['currency_unit'] !== '' ) {
$currency_unit = $data['currency_unit'];
于 2013-08-15T08:46:00.430 回答
0

你可以使用这样的格式:

// Calculate Total Price
$total_price = $book_room_price * $total_stay;

$total_price = $total_price * 0.9;

// Get currency unit stored in the theme options
if ( $data['currency_unit'] !== '' ) {
    $currency_unit = $data['currency_unit'];

对于 % 10 = 0.9

对于 % 15 = 0.85

对于 % 20 = 0.8

于 2013-08-15T08:46:38.497 回答