Show Inventory Only For Logged In users

By default the inventory available is shown for everyone, if enabled. Use this filter to show the inventory available only for logged in users.

Instructions

Code

Filename: gpi-show-inventory-only-for-logged-in-users.php

<?php
/**
 * Gravity Perks // Inventory // Show Inventory Only For Logged In users
 * https://gravitywiz.com/documentation/gravity-forms-inventory/
 *
 * Instruction Video: https://www.loom.com/share/2d9843302a54456987ed2c66a83612ba
 *
 * By default the inventory available is shown for everyone, if enabled.
 * Use this filter to show the inventory available only for logged in users.
 */
add_filter( 'gpi_inventory_available_message', function( $message ) {
	if ( is_user_logged_in() ) {
		return $message;
	}
	return '';
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.