Mircian

Adding custom commissions to WC Vendors

Let’s say for some reason you want to add custom commissions to WC Vendors. The main thing you’ll need is the filter “wcv_commission_rate“.

The way this filter works is that it allows you to add on top of the calculated commission by also passing along the product price.

Use cases & code

Let’s say for example that you want your vendors to cover the credit card commissions. You’d have to check the gateway used for checkout on that specific order and update the commission.

You can see the code below:

See the gist on github.

Please note that the gateway may not approve of this practice! Always check their terms before doing this.

Another nice use case would be to give vendors different commissions based on the order location. So let’s say that you want to give them more of the sale for countries in which you have less sales.

In this case you’d have something among the lines of:

See the gist on github.

Notice that in this case, the commission gets added to the initial commission so the vendor actually gets MORE.

Be careful though – if you are going to set options for this, don’t allow users to go over 100%. I would also add a check directly in the function above in such a case.

Another nice use case I just thought of would be to check if the customer is new on the website and give the vendor a bonus like – no commission for the first purchase!

Let me know in the comments if that would be a good idea for a plugin.

Exit mobile version