Posted on

How to enable quote request only to selected roles in WooCommerce.

The following setup enables you to enable quote request checkout only to selected roles and allow others to buy and checkout normally.

If you need help setting it up, we can help.

Set the default setting to RFQ.

cid:image001.png@01D64977.7C2EDC30

In the roles, leave 4a blank and in 4b add the role(s) that can only request a quote. You have to create the role first.

cid:image002.png@01D64978.B1C46670

At the very bottom of the page, enter a label for people who can purchase(everybody else). This

Is the label for the cart button .

cid:image003.png@01D64978.B1C46670

In the labels section use “Add to Quote”

cid:image004.png@01D64978.B1C46670

And finally add this to the bottom of your functions.php

if(function_exists('gpls_woo_rfq_purchase_only')) {

    add_action('init', 'gpls_woo_rfq_check_role', 1);

    function gpls_woo_rfq_check_role()
    {
        $in_role = false;

        if (is_user_logged_in())
        {

            $user = wp_get_current_user();

            $user_roles = $user->roles;

            $eligible_roles = get_option('settings_gpls_woo_rfq_plus_visible_price_roles', 'no');

            $option_value_list = explode(',', $eligible_roles);

            foreach ($user_roles as $cat_id) {

                if (in_array(trim($cat_id), $option_value_list)) {
                    $in_role = true;
                }
            }
        }

        if($in_role == false){
            gpls_woo_rfq_purchase_only(); // user can see prices and purchase normally
        }


    }

}

Posted on

How to have a custom form for each product or service in the NP WooCommerce Quote Request?

If you need a form ( or different forms for different types of products) in the product page, then if you can use the powerful WooCommerce product Add-Ons (which requires the Plus version) or our simple product extra fields. product extra fields does not requires the Plus version

The advantage of WooCommerce product add-on is you can attach a price to the extra fields. With extra fields, you cannot assign a price to the extra options or fields. Please note that in product page, the form is attached to that line item in the quote. By contrast the forms in the checkout pages, are attached to the whole order