0

Good morning,

I want to deactivate a checkbox in the seller accounts of dokan shops when their subscription ends.

I have created three subscriptions and when it ends I will automatically want the checkbox to be unchecked in their wordpress account.

How to do ?

I have created a function to activate them automatically on purchase already.

add_action( 'woocommerce_thankyou', 'bw_checkout_save_user_meta' );
 
function bw_checkout_save_user_meta( $order_id ) {
   $order = new WC_Order( $order_id );
   $user_id = $order->get_user_id();
   $items = $order->get_items();

foreach ( $items as $item ) {

$product_id = $item['product_id'];

if ( $product_id == '8477' ) {    
      update_user_meta( $user_id, 'dokan_disable_auction', 'no' );
       //update_user_meta( $user_id, 'dokan_disable_auction', 'false' );
  }
}
}
/**automatisation apres commande produit enchere mensuel activer est coche dans le compte directement**/
add_action( 'woocommerce_thankyou', 'bw_checkout_save_user_meta_2' );
 
function bw_checkout_save_user_meta_2( $order_id ) {
   $order = new WC_Order( $order_id );
   $user_id = $order->get_user_id();
   $items = $order->get_items();

foreach ( $items as $item ) {

$product_id = $item['product_id'];

if ( $product_id == '8476' ) {    
      update_user_meta( $user_id, 'dokan_disable_auction', 'no' );
      
  }
}
}
/**automatisation apres commande produit antiquaire a la une le vendeur est coche dans le compte directement**/
add_action( 'woocommerce_thankyou', 'bw_checkout_save_user_meta_3' );
 
function bw_checkout_save_user_meta_3( $order_id ) {
   $order = new WC_Order( $order_id );
   $user_id = $order->get_user_id();
   $items = $order->get_items();

foreach ( $items as $item ) {

$product_id = $item['product_id'];

if ( $product_id == '6974' ) {    
   
  update_user_meta( $user_id, 'dokan_feature_seller', 'yes' );
  }
}
}

THANKS

  • The same way u did for purchasing you can go check what hooks are available when subscription ends. – Snuffy Jun 16 '23 at 08:48

0 Answers0