Restrict Product Sale by Time Period of User Registration in WooCommerce

The PHP code in this download folder enables the shopkeeper to remove the add to cart button for users based on length of user registration period.

In this example, if the user has been registered for less than 1 month, they can’t add the product to cart and checkout.

The download also includes a 2nd code snippet to display a message for users who have been registered more than the length of the registration period set in the code and users who have been registered less than the same period.

Memberships

You can use the function in this down with a conditional tag your membership plugin includes to check if a user is active and how long they have been active or registered for enabling you to display or remove the add to cart button conditionally.

Installation

Copy and paste the PHP code to the end of your child themes functions file or code snippets plugin and configure the settings.

Settings

Line 15, swap out the product id or ad a comma separated list of product id’s.

Line 15, modify the number of days to suit your own requirements.

Download Folder

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.