Okay
  Public Ticket #3405425
Commissions
Closed

Comments

  • Carlos started the conversation

    Greetings, 

    I would like to know if it is possible to make the Woocommerce "fee" can be considered MarketKing commissions. 

    What happens is that I need to apply certain logics that can not be applied with the tax or shipping functions, and adding them as a fee is not recognized by MarketKing as a commission.

  •  2,214
    WebWizards replied

    Hello Carlos,

    Thank you for getting in touch,


    Do you want to add a general fee, e.g. a service charge, and have that go directly to the website admin? It's possible to achieve that. There are a few different ways this can be set up.

    If you would like to give me a specific example of a setup you want to achieve, I can give you more details about how that can be done.


    Kind regards,

    Stefan

  • Carlos replied

    Thank you for responding to my request. 

    What happens is that I have to apply conditional logic:

    If the product being purchased has a value greater than 1000 monetary units, a fee of 8% should be added to the order, which should go as administrator's commission, but if the product has a value equal to or less than 1000, a fixed fee of 80 monetary units should be added, which should go as administrator's commission. 

    So, for example, if in the shopping cart the buyer has 1 product with a value of 2000, and 2 products with a value of 500, a fee of 320 monetary units should be added to the order: 

    Product 1 (2000): 8% = 160
    Product 2 (500): 80 
    Product 2 (500): 80
    Total = 160 + 80 + 80 + 80 = 320

    As you understand, this can not be achieved with Woocommerce taxes, so I have done it with PHP code adding the fee to the order as applicable, but being fee and not tax, the MarketKing system does not recognize it as administrator's commission.

  •  2,214
    WebWizards replied

    To make the fees be admin commissions, you can configure it with the Pro version of MarketKing as follows:

    In MarketKing -> Commission Rules, set it like this:

    6729843124.png

    (the trick is that the commission is only for products, not the entire order)

    Importantly in MarketKing -> Settings -> Commission enable 'Rules set vendor commission':

    2233511188.png

    So in summary, vendors receive 100% of products value, and the rest (such as fees) goes to the admin.



    Here is an example:

    I use this free plugin to add a 10% fee: https://wordpress.org/plugins/woo-add-custom-fee/

    Here is how you can set it (in WooCommerce -> Settings -> Custom Fee):

    5887845709.png

    In cart I have a product that costs $45:

    The cart totals show 45 and a $4.5 service fee, total $49.50

    8784827489.png

    On the vendor's dashboard, they will see their earnings (45 out of 49.5):

    9066685634.png

    When they open the order, they can clearly see the service fee is the only thing that is not received by them:

    4589167939.png
  • Carlos replied

    Thank you very much.

    However, on my site, in addition to the fee charged to the customer, a 5% sales commission is also charged to the seller, doing that you recommend would give 100% of the value of the product to the seller, and I should give only 95%. 

    It is also very important that in the orders, the seller sees only the total value of the products sold, without showing the fee charged to the buyer, so that he can see only the information of his sale and his profit, without taking into account the commission charged by the administrator to the buyer.

  •  2,214
    WebWizards replied

    In that case you can modify the rule here to 95 instead of 100:


    6729843124.png


    The admin would receive 5% + fees.


    It is also very important that in the orders, the seller sees only the total value of the products sold, without showing the fee charged to the buyer, so that he can see only the information of his sale and his profit, without taking into account the commission charged by the administrator to the buyer.

    That information is part of the order contents so it's not possible to remove it or hide it from the vendor.

  • Carlos replied

    1) In some cases, some sellers are also charged a fixed commission in addition to 5%, this would not affect? 

    2) Then, regarding the total in the orders, wouldn't there be any hook or filter to wrap the information and show the total without the fee? 

    3) Another question sorry, is there any hook that returns the commission rate that is applied to a seller? I was looking at the documentation but I do not see any.

    4) Last question, would it be possible to show in the marketking panel a wordpress menu that is not natively in the panel? I have a section in wordpress that I would like that the sellers could access but I do not understand very well how to do it.

  •  2,214
    WebWizards replied

    (1) In this case, it would not be possible to also have a fixed commission. If you have a fixed commission, you would need to set the commission for admin instead of vendors, so it would not work for fees anymore.

    (2) Very difficult because we are using a WooCommerce function there:

    WC_Meta_Box_Order_Items::output($post);

    so we are not displaying that from scratch


    (3) There's no such hook because in our plugin commission is applied in many different ways, by product, tag, vendor, etc.


    (4) Do you mean on the vendor dashboard? You can add a custom page as described in our developer documentation https://woocommerce-multivendor.com/docs/developer-documentation-functions-hooks-custom-code-plugin-integrations/ , but it would be complex to make a backend page display there, it requires advanced development knowledge.


    Kind regards,

    Stefan

  •   Carlos replied privately
  •   Carlos replied privately
  •  2,214
    WebWizards replied

    Hi again,

    From the screenshot I understand you're using our MarketKing Pro plugin? If so, kindly please provide us with your license key for the plugin so we can add that to our database. To get your key:

    If you purchased on KingsPlugins.com - Where is my KingsPlugins license key?

    If you purchased on CodeCanyon (Envato/ThemeForest): Where is my Envato purchase code?

    2) Entiendo, no se podria entonces crear un filtro que se aplique justo alli para restar la tasa de comision? 

    It's possible technically, and you could customize the order page PHP template to try to achieve that. However it's quite a niche use case so it would be difficult for us to add that directly,


    3) Necesito realmente poder obtener de alguna forma la tasa de comision que se le aplica al vendedor, ya que he creado un menu especial donde el vendedor podra ver las ventas de un producto especifico, cuando ha vendido y cuando ha ganado para ese producto.

    We can send you some custom code to help get the commission rate for a seller / product. It depends a lot on your commission rules. Please share share some screenshots of your commission rules and settings so we can better understand that.

  •   Carlos replied privately
  •  2,214
    WebWizards replied

    Hi Carlos,

    It's possible you purchased on Envato Market (CodeCanyon). I would advise to try finding your CodeCanyon account. If you did purchase there, you have access to lifetime plugin updates based on that purchase and may only have to renew the support service.

    Otherwise you can purchase a license from us directly: https://kingsplugins.com/woocommerce-multivendor/marketking/pricing/#div_block-90-84


    Regarding your questions:

     - "it throws the error "You can not buy your own events"" 

    To allow vendors to buy their own events you can add this PHP code snippet to your site:

    add_filter('marketking_vendors_cannot_buy_own_products','__return_false');
    

    - "it does not allow me to process purchases of 0 value"

    I believe this is something we solved in recent updates. For this please update to the latest possible versions of MarketKing Core and Pro.


    Kind regards,

    Stefan

  • Carlos replied

    Greetings,

    Thank you for your reply. 

    Ok, I will proceed to purchase the license by this way, because I can not find access to the CodeCanyon account, but you have not answered my question yet, if I buy the license, can you help me to correct the issues that I have told you in previous questions? 

  •   Carlos replied privately
  •  2,214
    WebWizards replied

    Hi again,

    (1) I am not completely sure what the issue is with purchases of 0 value. Are you sure that is coming from our plugin? Does the issue go away if you deactivate MarketKing?

    If it does, yes, we can assist to investigate and resolve this,


    (2) If you are looking to add a complete section of WordPress such as "/wp-admin/edit.php?post_type=page" to the vendor dashboard 0 this is very complex technically - it can only be done with custom code. 

    You would need to create a page interface from scratch, I do not believe there is any way to simply copy the admin interface to the vendor dashboard (because the scripts, classes, etc would not exist on the frontend)

    We can assist you with information but we do not do custom code directly ourselves.


    (3) We don't have a way to show the total without fees on the order pages unfortunately.


    (4) Yes, we can provide code to get the commission rate for a product for a vendor.

  •   Carlos replied privately
  •  2,214
    WebWizards replied

    Hello Carlos,

    Thank you for purchasing!


    Regarding your questions there:

    (2) When using Fooevents, each vendor can create events and configure ticket settings for those events:

    7547194232.png

    Vendors can choose to get a copy of each ticket that is created:

    7161207394.png

    Vendors can also export a list of all attendees:

    2622285897.png


    There is currently no tickets page on the vendor side yet.


    (3) I understand that you would like to change it to show a total without fees here on the order page:

    5858787977.png


    You could override the manage-order.php template

    https://woocommerce-multivendor.com/docs/how-to-edit-marketking-pages-templates/ )

    Currently the entire area there under "order items" is generated using this WooCommerce function:

    WC_Meta_Box_Order_Items::output($post);


    To display it differently, you may need to remove that, and instead build your own custom functions. For example use the $order object and only show specific values, such as $order->get_subtotal() , 


    (4) Here you can use the following code:

    // you need variables $vendor_id, $product_id
    $rules = marketking()->get_all_vendor_rules($vendor_id);
    $rules_that_apply_to_product = marketking()->filter_which_rules_apply_to_product($rules, 0, $product_id);
    $commission_percentage = 0;
    foreach($rules as $rule_id){
        $howmuch = floatval(get_post_meta($rule_id,'marketking_rule_howmuch', true));
        if ($howmuch > $commission_percentage){
            $commission_percentage = $howmuch;
        }
    }
    

    (5) and (6) It is possible by editing the dashboard-content.php template

    https://woocommerce-multivendor.com/docs/how-to-edit-marketking-pages-templates/ )


    There you would need to set "post_status" to "completed" instead of the default "any":

    3292640329.png


    This should also help show only products that have been sold, without counting cancelled or failed orders.



  •   Carlos replied privately
  •  2,214
    WebWizards replied

    Hi again,

    (2) I understand, we can consider expanding the integration in future updates, but it's quite complex and not something I could add now quickly.

    If you are considering custom coding, it is possible to add a custom page to the MarketKing dashboard as described in our developer documentation: https://woocommerce-multivendor.com/docs/developer-documentation-functions-hooks-custom-code-plugin-integrations/


    (5-6) It's the file in the Core plugin. I was suggesting to copy that to your child theme under a /marketking/ folder. This way you can also update the plugin in the future without losing changes.

    Please try to use 'wc-completed' instead of 'completed', that might be the issue.


    We can also check it directly if you would like to share backend access to the site or a staging clone site, to troubleshoot and try to get this working.

  •   Carlos replied privately
  •  2,214
    WebWizards replied

    5-6)

    We feel these are best achieved through overwriting the template - otherwise there are many different changes needed, and each store has their own requirements for customization - we would need hundreds of hooks to meet all customization needs. 

    This is only a display template so it does not contain functionality that would cause issues or errors in the future if changes are made to the plugin. Since it's a template we also do our best to make changes to it as rarely as possible.


    Regarding the statistics donut, you would need to:

    -> Remove the code area with 'pending' / 'cancelled' in that template:

    8375672803.png

    -> Add this PHP code snippet to your site:

    https://pastecode.io/s/rheia828

  •   Carlos replied privately
  •   WebWizards replied privately
  •   Carlos replied privately
  •   Carlos replied privately
  •  2,214
    WebWizards replied

    Hello Carlos,

    Thank you for your patience on this,


    (1) So, what I need to know is, what hook can I use to get the commission rate of the supplier that is viewing the report? 

    If you have a single commission rate for each seller, you could use this code to get the commission rate, based on the vendor ID:

    $rules = marketking()->get_all_vendor_rules($vendor_id);
    foreach ($rules as $rule_id){
        $commission_rate = floatval(get_post_meta($rule_id,'marketking_rule_howmuch', true));
    }

    (2)When I change the author of a product to another author, it still shows the sales and commissions to the previous vendor....It happens frequently that we need to change the author of a product

    The plugin calculates commissions based on each order. Each order would need to be modified in order for the commissions to change the author. It is quite difficult, I do not see an easy way to change all earnings from a product.

    Can you give us more information about why you need to change the author of products? Perhaps we can think of a different solution or approach.

    (3) Regarding commissions and discounts,

    This depends on the configuration of commission rules. To solve this, you would need to set rules based on order, not based on products:

    8480921339.png

    This is because the discount is applied to the order.

    When set like this, the commissions will apply to the final order value (after discounts).



    Kind regards,

    Stefan

  •   Carlos replied privately
  •  2,214
    WebWizards replied

    Hello Carlos,

    Thank you for the details:


    (2) 

    You would need to change the post_author (author) field of all orders, from the old account to the new one.

    Then in the wp_postmeta table, you would need to change all keys "vendor_id" from the old vendor ID to the new vendor ID.

    The user meta keys "marketking_outstanding_earnings" and "marketking_user_balance_history" of the old vendor should be set to the new vendor. Overall it is quite complicated.


    I believe the easiest way would be to just modify the previous author user account, and change the email and password so it matches the new account. I think there may be a flow along these lines: e.g. when a supplier registers, just take their email and password and add them to the old account instead, it is easier in my opinion.


    (3)

    I see what you mean. By default, we do not have a feature for it if commission rules are based on products. It could only be changed programmatically.

    I tried writing a code snippet to adjust the commission programmatically based on order discounts:

    add_filter('marketking_final_vendor_commission', function($vendor_commission, $order_id, $vendor_id){
        $order = wc_get_order($order_id);
        // Convert the discount total and order total to floats
        $order_total = floatval($order->get_total()); // Total amount of the order including discount
        $order_discount = floatval($order->get_total_discount()); // Total discount amount as a float
        $discount_percentage = 0;
        if (($order_total + $order_discount) > 0) {
            $discount_percentage = ($order_discount / ($order_total + $order_discount)) * 100;
        }
        // Reduce the vendor commission by the discount percentage
        $adjusted_commission = $vendor_commission - ($vendor_commission * ($discount_percentage / 100));
        // Ensure commission does not become negative
        $adjusted_commission = max($adjusted_commission, 0);
        return $adjusted_commission;
    }, 10, 3);
    

    It should reduce the commission based on the % of the discount.

  •   Carlos replied privately
  •  2,214
    WebWizards replied

    Unfortunately that would not affect old orders, only new ones.

    For old orders, the only option would be to manually change the commission value, by editing the earning associated with each order.


    Another option would be to make a general payout manual adjustment in MarketKing -> Vendors -> View Payouts and scroll down to:

    8069207109.png

    This adjusts the vendor's balance.