Weekly Discount For Custom Contributors Role Based on Count of Users Posts

$75.00

The 80 lines of PHP code in this download include 3 custom functions which enable the store owner to give a percentage discount on the cart subtotal to contributors who submit a set number of posts. Otherwise, a notice is displayed to logged in reviewers warning the discount is only available once a week.

The custom functions hooked to the woocommerce_cart_calculate_fees action are :

purchased_this_week() Returns true if the current user has purchased a product within the last week. You can set this function to any time frame.

reviewer_update_custom_role() Adds a custom role named Product Reviewer which matches the default contributor role capabilities. You can set this to any default role or custom role with an array of custom capabilities.

is_a_reviewer() Checks if the current logged in user has the Product Reviewer role.

Code Installation

Copy & paste the PHP code to the end of your child themes functions.php file or custom functionality plugin.