• Resolved bertotto

    (@bertotto)


    Hello, I have been following the topic: https://www.ads-software.com/support/topic/compatibility-with-dokan-multi-vendor-market/

    for the solution to the same “issue.” Adding the code to the functions.php provided by @iovamihai worked.

    However, I wanted to improve this a bit more. In my case, I have a 10% fee for the administrator (marketplace) and 50% for affiliates.

    After adding the script provided in the mentioned topic, I noticed that the 10% commission is deducted only from the seller and not from the affiliate, meaning the affiliate is not earning the same as the seller. For example:

    PRODUCT PRICED AT $10

    Seller receives: $4 (representing 60% – 50% went to the affiliate and 10% to the marketplace). Affiliate receives: $5 (50% of the total value)

    Would it be possible to change this to equalize it? Deducting the marketplace percentage first and then distributing the commissions to the seller and affiliate?

Viewing 1 replies (of 1 total)
  • Plugin Author iova.mihai

    (@iovamihai)

    Hey @bertotto,

    Thank you for reaching out! Technically speaking, this cannot be done. The commission is calculated based on the amount that the customer is paying. This value cannot be adjusted I’m afraid.

    However, with some math, we could recalculate the commission just before it’s added to the database.

    function slicewp_custom_pre_insert_commission_data_adapt_amount( $data ) {
    	
    	if ( slicewp_doing_admin_action( 'add_commission' ) ) {
    		return $data;
    	}
    	
    	if ( empty( $data['amount'] ) ) {
    		return $data;
    	}
    	
    	$data['amount'] = slicewp_sanitize_amount( ( $data['amount'] * 2 - $data['amount'] * 0.1 ) * 0.5 );
    	
    	return $data;
    	
    }
    add_filter( 'slicewp_pre_insert_commission_data', 'slicewp_custom_pre_insert_commission_data_adapt_amount', 50 );

    The code will double the commission amount (considering that you offer 50% to the affiliate), then it will subtract the 10%, which is the marketplace fee, and then half the result to have the final commission amount (again, because the affiliate’s 50%).

    I believe that this code snippet, alongside the code snippet from the other ticket, should work nicely.

    Thank you and best wishes,

    Mihai

Viewing 1 replies (of 1 total)
  • The topic ‘Compatibility with Dokan (Multi-Vendor Market)’ is closed to new replies.