How to overwrite dokan commision file code using function.php
-
Dear Team,
I hope this message finds you well. I am seeking your guidance regarding overriding the commission calculation in Dokan plugin using the function.php file in my WordPress theme.
I need to modify the commission calculation formula by replacing $earning = ( $product_price * $commission_rate ) / 100; with $earning = ( $product_price * $commission_rate ) / 110;.
The relevant code snippet from the Dokan plugin’s file that requires modification is as follows:
if ( 'percentage' === $commission_type ) { $earning = ( $product_price * $commission_rate ) / 110; $earning = $product_price - $earning; // vendor will get 100 percent if commission rate > 100 if ( $commission_rate > 100 ) { $earning = $product_price; } }
As I would like to avoid modifying the plugin directly, I am seeking guidance on how to implement this change through the function.php file in my theme.
I would greatly appreciate it if you could provide the necessary instructions or code snippet to override the calculation logic successfully.
Thank you for your attention and support. I look forward to your prompt response. ??
- The topic ‘How to overwrite dokan commision file code using function.php’ is closed to new replies.