Change listing status when vendor is not active


Is there a code reference or a solution to put automatically all the vendor’s listings to “Draft” when vendor profile is changed/set to “Pending review”.

Currently if I disable the vendor profile then all his listings are still visible which is not good in my opinion.

Thanks in advance!

Please try this PHP snippet. But please note that it can require further customization and testing. If you are not familiar with the code customization, then please consider hiring someone for custom work

	function($vendor_id, $new_status, $old_status, $vendor){
		if('pending' !== $new_status){
		$listings = \HivePress\Models\Listing::query()->filter(['vendor' => $vendor_id])->get();
		foreach($listings as $listing){
1 Like

Thanks, I’ll check!

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