Im using EDD_Fees class for adding extra fee to products, Iv’e used this class before and it works like charm but now i can’t figure it out why amount equals to 0 (it seems returning null) But when i echo
shows the integer value.
Here is my full class code
$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
Im using EDD_Fees class for adding extra fee to products, Iv’e used this class before and it works like charm but now i can’t figure it out why amount equals to 0 (it seems returning null) But when i echo
shows the integer value.
Here is my full class code
$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
Share
Improve this question
edited May 5, 2020 at 20:49
vancoder
7,92428 silver badges35 bronze badges
asked May 5, 2020 at 13:51
TheXrionTheXrion
57 bronze badges
2
|
1 Answer
Reset to default 1I can't see where "$int_val" is defined, may be it is defined outside the scope of "cencored_function", it won't work if this is the case.
echo
ing to debug, usevar_dump()
instead, as that will show you the variable's type as well as its value. – Pat J Commented May 5, 2020 at 14:03