Close Listings Automatically

Hi,

I was wondering if there is an option that would close listings automatically after they got bought?

Cheers!

Hi,

Just wanted to check on this again, thanks!

You can change code as in this example:

diff --git a/app/state_machines/transaction_process_state_machine.rb b/app/state_machines/transaction_process_state_machine.rb
index 1c8484e74..0232791c0 100644
--- a/app/state_machines/transaction_process_state_machine.rb
+++ b/app/state_machines/transaction_process_state_machine.rb
@@ -32,6 +32,10 @@ class TransactionProcessStateMachine
       ConfirmConversation.new(transaction, payer, current_community).activate_automatic_confirmation!
     end
 
+    # Automatically close paid listing
+    transaction.listing.open = false
+    transaction.listing.save
+
     Delayed::Job.enqueue(SendPaymentReceipts.new(transaction.id))
   end
 

Awesome, thanks a lot!