• Resolved Ronan Prado

    (@ronanprado)


    Hi team, thanks for solution! I have a question:

    • Is possible disable wallet for different of user roles ? Some snippet to do this ?
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    @ronanprado You can use the attached code to block wallet usage for author user role.

    add_filter( 'woo_wallet_is_user_wallet_locked', 'woo_wallet_is_user_wallet_locked_callback', 10, 2 );
    if ( ! function_exists( 'woo_wallet_is_user_wallet_locked_callback' ) ) {
    	function woo_wallet_is_user_wallet_locked_callback( $is_locked, $user_id ) {
    		$user = new WP_User( $user_id );
    		if ( in_array( 'author', (array) $user->roles, true ) ) {
    			// The user has the "author" role so block wallet.
    			$is_locked = true;
    		}
    		return $is_locked;
    	}
    }
    Thread Starter Ronan Prado

    (@ronanprado)

    Hi Subrata ! Thanks for response, The snippet was applied and the tab “wallet” on Myaccount is hidden “ok”, but for this user yet workings cashback in all store when the product is added on the cart and the messages is showed:

    “Upon placing this order a cashback of (price) Will be credited to your wallet.”

    Is it possible to block in all parts of store for this user role?

    Plugin Author Subrata Mal

    (@subratamal)

    @ronanprado Also please use the attached code.

    add_filter( 'display_cashback_notice_at_woocommerce_page', 'display_cashback_notice_at_woocommerce_page_callback', 10, 1 );
    if ( ! function_exists( 'display_cashback_notice_at_woocommerce_page_callback' ) ) {
    	function display_cashback_notice_at_woocommerce_page_callback( $display ) {
    		if(is_wallet_account_locked()){
    			return false;
    		}
    		return $display;
    	}
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable wallet for different user roles’ is closed to new replies.