Anonymous Anonymous - 16 days ago
874 0

No description

PHP

Welcome Message

<?php

/* Plugin Name: MyPlugin
 * Version: 0.0.1
 * Author: Me
 * Description: None
 */

class MyPlugin {

  public function __construct() {

    add_filter('woocommerce_registration_redirect', [$this, 'woocommerce_registration_redirect']);
    add_action('woocommerce_account_content', [$this, 'woocommerce_account_content']);

  }

  public function woocommerce_registration_redirect($redirection_url) {

    WC()->session->set( 'my_custom_check' , 1 );

    return $redirection_url;

  }

  public function woocommerce_account_content() {

    if ( WC()->session->get('my_custom_check') ) {
      echo __('Welcome to my shop!', 'textdomain');
      WC()->session->__unset( 'my_custom_check' );
    }

  }

}

new MyPlugin();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download