User Earnings not showing point type
-
Hi there,
I wrote the code below based on your documentation. It assigns points, so it is working but the issue is that the transaction does not show on user’s earnings. How can I make it show?
add_action( 'woocommerce_payment_complete', 'zeller_award_points_per_amount_sold_on_woocommerce' ); function zeller_award_points_per_amount_sold_on_woocommerce( $order_id ) { $order = wc_get_order( $order_id ); // The ratio value used to convert the amount spent into points // Setting it to 1 will award the same points as amount spent ($40 = 40 points) // Setting it to 2 will award the double of points of amount spent ($40 = 80 points) // Setting it to 0.5 will award the half of points of amount spent ($40 = 20 points) $ratio = 1; // The points type slug you want to convert the amount $points_type = 'zeller'; //Get vendor ID for product in order foreach( $order->get_items() as $item_id => $line_item ){ $vendor_id = get_post_field( 'post_author', $line_item->get_product_id()); } // Award the points to the vendor gamipress_award_points_to_user( $vendor_id, absint( $order->get_total() * $ratio ), $points_type ); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘User Earnings not showing point type’ is closed to new replies.