i tried this
public static function woocommerce_get_price( $product_id ) {
$price = get_post_meta($product_id, '_price', true );
}
and then
$amount = round( floatval( $referral_rate ) * floatval( $price ), AFFILIATES_REFERRAL_AMOUNT_DECIMALS );
but it’s not working
I’m using Affiliates Integration with Woocommerce
I need to define different comissions for each product…
I can create a custom field when inserting a new product called commission then insert the commission, then in the file affiliates-woocommerce-light.php I need to access to that value defined for commission……
any help please?
or may it’s better if I in the order class have a variable to calculate toal product commissions (commission product A + commission product B + …) and then access that variable in affiliates-woocommerce-light.php….. what do you think?
how is it possible to return a value of a custom field?
var $product_custom_fields;
is that it?
If I define a custom field named “xpto”, how can I get its data to a variable?
get_post_meta( $order_id, 'xpto', true );
You need to know the $order_id though of course.