WooCommere Simple Auction
Role Based Bidding and Payment Method Verification

Last updated: 3rd Nov 2021.

This modification for Simple Auctions is meant to be used by WordPress developers and skilled WordPress users who know basic PHP editing and have worked with templates and PHP files in general. If you have any questions or want us to setup plugin, please open support ticket.

Change Log


** Version 2.0 **
- Add: arrays instead of constants for easier adding of multiple roles
- Fix: notice

** Version 1.0 **
- Initial release

Overview and Features

WooCommere Simple Auction Role Based Bidding and Payment Method Verification

WooCommere Simple Auction Role Based Bidding and Payment Method Verification enables only specific roles to bid and change user role to one that can bid after purchase of specific product (usable for verifying payment method). Settings are hardcoded as constants to avoid WordPress database calls (for settings) and have low impact on performance since functions below have to be called on every place bid request.

Overview and Features

  • dissallow specific (default) user role to be able to place a bid
  • change user role after purchasing predefined product to user role that can place bid (verify payment method)

Installation

Source: https://codex.wordpress.org/Managing_Plugins#Installing_Plugins

Note:

Make sure to install WooCommerce and WooCommerce Simple Auctions before you activate plugin.

Setup

Since settings are hardcoded you will have to edit woocommerce-wsa-roles.php file before you can use plugin. If you never edit PHP file please open support ticket and we will do setup for you. Steps for DIY setup:

  • if you want to verify payment method, you will need to create a product which user will purchase to verify payment method
  • go to Products => Add Products and define virtual product called for example "Become Bidder" and set $1 for a price
  • add title, description, images, featured image, select category - all things you do when adding regular product
  • find out ID for that product
  • in your editor change this constant define('WSA_ROLE_VERIFY_PAYMENT_PRODUCT_ID', 1) so number 1 is replaced with actual product ID, see screenshot:
    screenshot
  • you can also setup two other variables - default values should be ok for most cases
  • list of roles can be found in WordPress settings -> General -> New User Default Role

Since default role set in WordPress settings is "subscriber" we will disallow this role from bidding and give user "customer" role once they purchase (verify) payment method.

Keep on your mind that WooCommerce by default gives "customer" role to a user when user registers via the checkout or signup process so you can use something like code snippet below to set "subscriber" role for WooCommerce registrations too (should be in functions.php):

	// Replace 'customer' role (WooCommerce use by default) with your own one.
add_filter('woocommerce_new_customer_data', 'wc_assign_custom_role', 10, 1);

function wc_assign_custom_role($args) {
	$args['role'] = 'subscriber';	
	return $args;
}

There is also option to create custom roles using free User Role Editor plugin. For example you can set default user role to be customer role then using User Role Editor create copy of customer role called bidder. Then just instead of subscriber set default role to be customer and bidder role will be elevated customer role which can place bids. See screenshot below:

screenshot


WooCommerce Simple Auctions

wpgenie plugin

Love this plugin?

This plugin is created by wpgenie. Check out our Envato profile where you can support us by purchasing our plugins, give us feedback and post your ideas and feature requests, ask for support and rate our items. Check out our free stuff.

We do WordPress developing, plugins for WordPress & WooCommerce, eCommerce sites based on WooCommerce, WordPress performance optimization and managed WordPress hosting.