Points For Purchase Multicurrency
-
Hello,
We have been using your plugin for 2 years and we are happy. We will publish a new version of our website in a few months and this site is multilingual so it includes multiple currencies.
Our settings on our old site allow the user to earn 1% points for each sale made. But in multicurrency this seems a bit unfair.
If the user wants to buy the product in USD, this means that he will earn 1 point for 100USD. However, if the user wants to buy the product in TRY, he gets 18 points because it is 100USD=1800TRY. How we can solve this problem?
Our code that allows users to earn 1% points from each sale;
function mycred_pro_reward_order_percentage( $order_id ) { if ( ! function_exists( 'mycred' ) ) return; // Get Order $order = wc_get_order( $order_id ); $cost = $order->get_subtotal(); // Do not payout if order was paid using points if ( $order->payment_method == 'mycred' ) return; // The percentage to payout $percent = 1; // Load myCRED $mycred = mycred(); // Make sure user only gets points once per order if ( $mycred->has_entry( 'reward', $order_id, $order->user_id ) ) return; // Reward example 25% in points. $reward = $cost * ( $percent / 100 ); // Add reward $mycred->add_creds( 'reward', $order->user_id, $reward, 'Reward for store purchase', $order_id, array( 'ref_type' => 'post' ) ); } add_action( 'woocommerce_order_status_completed', 'mycred_pro_reward_order_percentage' );Thank you
The page I need help with: [log in to see the link]
The topic ‘Points For Purchase Multicurrency’ is closed to new replies.