Remove fixed commission from free items

Hi,

I have set up a commission on sales, but I’ve noticed the fixed commission (set at 20p) is being charged on free listings. Is there a way of disabling the commission on £0.00 listings? I see I can do that in WooCommerce, but can’t find a way of removing the HivePress commission.

Thanks

Hi,

Thanks for reporting this, the bug is confirmed, and we’ll fix it in the next update.

Great. Thanks Andrii. Any idea when as I can’t launch until this is resolved?

Hi,

Unfortunately, there is no exact timeframe, but we’ll consider fixing this feature as soon as possible.

As free items are central to our proposition I can’t launch until this bug is fixed. If you aren’t able to give any indication on time could you suggest any code which I can use as a temporary workaround?

I just need the fixed commission fee to be 0.00 if a listing has the price set to 0.00.

Or if it is in any way simpler, the fee at 0.00 if the attribute ‘proceeds_to_charity’ > option "free-item’ is selected. I can source the code from elsewhere, but would need to know the references to your commission function.

Any help would be appreciated.

Thank you for waiting. Please try this PHP code snippet

add_filter(
	'hivepress/v1/models/listing/cart',
	function($cart, $listing){
		
		if(!$listing->get_price()){
			error_log('t');
			$cart['meta']['fees']['service_fee'] = [
				'name'   => 'Service Fee',
				'amount' => 0,
			];
		}
		
		return $cart;
	},
	1000,
	2
);

Thanks for this Yevhen. I’ve applied it and it hasn’t worked as expected.

On the buyer side (mobile image below), it now references a ‘service fee’ of zero on the order confirmation. There had been no mention of a service fee on the buyer side until I activated the snippet.

On the seller side (desktop image below), you’ll see the commission is still being charged. The 20p fixed fee leaves them with a -£0.20 balance. This is what I need removing, so free items generate zero commission.

I hope this info helps you isolate the problem.

Thanks!



,

Thank you for waiting. Please try this PHP code snippet instead

add_action( 
	'woocommerce_thankyou', 
	function ($order_id){
		$order = \HivePress\Models\Order::query()->get_by_id($order_id);
		
		if(!$order || $order->get_total()){
			return;
		}
		
		update_post_meta( $order_id, 'hp_commission_fee', 0 );
	},
	1000
);
1 Like

Great! That worked. Thanks so much Yevhen!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.