我使用EDD\\U Fees类为产品添加额外费用,Iv\'e以前使用过这个类,它的工作方式很有魅力,但现在我不明白为什么amount等于0(它似乎返回null),但当我echo
显示整数值。这是我的全班代码
$feeid_gen = date("Ydhis") . $download_id;
function cencored_function() {
// Additional Services Price START here
$cencored_fee = array(
\'amount\' => $int_val,
\'label\' => \'hbbl\',
\'id\' => $feeid_gen,
\'no_tax\' => false,
\'type\' => \'fee\',
\'download_id\' => $download_id,
\'price_id\' => NULL
);
EDD()->fees->add_fee( $cencored_fee);
/// Additional Services Price END here
}
add_action( \'init\', \'cencored_function\' );
cencored_function(); // Runned