• Resolved jjbte

    (@jjbte)


    V2.1 worked fine for me. The popup appeared nicely and allowed me to turn RBP on/off, enter prices, and save the settings.

    In addition, users logged in as Wholesale Buyer (one of the roles I use in my store and with RBP) were NOT able to add products to their cart if those products had RBP turned on, but no prices set (instead of “Add to Cart,” the button display “Read More”). This was perfect for me since all my products are available to retail customers, but only some are available for wholesale purchase.

    After updating to 2.2, the popup does not work. Instead of opening a popup, the RBP editor opens in the same window as a regular window. Worse yet, any changes I make are NOT saved.

    The other issue is the Add to Cart button. Now all products can be added to the cart by Wholesale Buyers. I wish to go back to the way the plugin worked in v2.1 and prior versions where the Read More button displayed. Otherwise, I just know I will have Wholesale Buyers trying to purchase my non-wholesale items and then complaining that they didn’t receive a discount. The new Product Visibility options do not help me since all I can do is hide the cart button for the Wholesale Buyer, which then makes it impossible for anyone in that role to purchase any products at all. If anything, I would need to be able to hide the cart button from Wholesale Buyers for products that have RBP either turned OFF or turned on but with no prices set for the Wholesale Buyer role.

    https://www.ads-software.com/plugins/woocommerce-role-based-price/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Varun Sridharan

    (@varunms)

    Hi,
    really sorry for the inconvenience caused.

    can you please provide me a screen shot + a live demo to check what is the exact issue.

    Thread Starter jjbte

    (@jjbte)

    Thanks for your quick reply. I sent you an email with screenshots, etc.

    Plugin Author Varun Sridharan

    (@varunms)

    i am unable to reply your email i get failure message.

    kindly contact me using other email id

    Thread Starter jjbte

    (@jjbte)

    I tried replying from another address. I can’t imagine what could have gone wrong with the first one. It has been receiving WordPress emails normally today.

    Plugin Author Varun Sridharan

    (@varunms)

    hi

    really sorry for the inconvenience caused.

    in version 2.2 Some Plugin files was not committed due to an error which caused the popup issue.

    this has been solved in V2.3 and perfectly working ??

    if you still face any issue. kindly contact me at any time ??

    Thread Starter jjbte

    (@jjbte)

    I did receive your first message in my host’s SPAM quarantine and whitelisted your plugin@ email address. The quarantine still sends out an error message, though.

    Anyway, thanks so much for communicating with me about these issues. There is no need to apologize. You have been very good about keeping this plugin up to date and with helping users resolve issues.

    I sent you an email with admin access, etc., for a test site that is nearly identical to the soon-to-be live site I am working on. The test site doesn’t have the same security restrictions for admin access.

    Your release of v2.3 did indeed fix the popup issue, so thank you very much for fixing that issue so quickly.

    I am still seeing the Add to Cart vs. Read More issue, though. This is different from the way the plugin behaved in all versions I tried before v2.2. Those previous versions displayed Read More rather than Add to Cart for products with RBP on but no prices set. That suddenly went away when I updated to v2.2. It was definitely still working in all versions up to and including v2.1. I’m hoping that behavior can be restored in a future update.

    Thanks again for all your help.

    Thread Starter jjbte

    (@jjbte)

    I found the code change that was made between versions 2.1 and 2.2 and caused the behavior change on the front end. To recap, in v2.1 and prior, RBP ON items with no set prices for a given role would display “Read More” instead of “Add to Cart” when a user was logged in with the given role. In other words, users in the given role could just view these items, but not actually add them to their cart.

    In addition, if these items were added to a user’s cart before the user logged in, the items were removed from the cart once the user did log in. This was perfect for my store since I have only some wholesale items I wish for Wholesale Buyer role customers to be allowed to buy.

    When I upgraded to v2.2 and beyond, that behavior changed. Now, all items have an Add to Cart button and can be purchased by Wholesale Buyers. I compared the various files in versions 2.1 and 2.2 and found a change in the file includes/class-product-pricing-frontend.php that caused this behavior change.

    In version 2.1, line 88 of includes/class-product-pricing-frontend.php is:

    if(isset($wcrbp_price_new[$cRole])){ $wcrbp_price = $wcrbp_price_new[$cRole][$price_meta_key]; }

    In version 2.2, this code (now beginning on line 90) was changed to:

    if(isset($wcrbp_price_new[$cRole])) {
       if(!empty($wcrbp_price_new[$cRole][$price_meta_key])){
          $wcrbp_price = $wcrbp_price_new[$cRole][$price_meta_key];
       }
    }

    I tried replacing the new code with the old (from v2.1) and my front end now behaves as it did before: with Read More buttons for items that have RBP turned on, but no prices entered for the given role.

    I’m not asking you to change the code back since you must have had a reason for making the change. However, if there is any way you can change it back without “breaking” something else, I’d really appreciate it. Your plugin is still quite good and useful to me regardless. If you can’t make the change, I’ll just have to find another way to keep Wholesale Buyers from purchasing non-wholesale items.

    Plugin Author Varun Sridharan

    (@varunms)

    Hi,

    have you tried using Price Visibility option in this plugin ?

    Thread Starter jjbte

    (@jjbte)

    Yes, but it appears to hide the price for a certain role regardless of whether Role Based Price is on/off, prices set for the role, etc. All I could really do with that is hide all product prices for a given role. I can see where this would be a useful option for some stores, but it doesn’t work for my particular setup. I’m just trying to keep a certain role from buying some products, but not all.

    Please don’t worry yourself too much about this. You fixed the popup issue, which was most important. I will figure something out. I have some ideas about how to go about it; I just haven’t had a chance to try them yet.

    Thanks very much for your time and attention. I really appreciate your efforts.

    Thread Starter jjbte

    (@jjbte)

    Using the WooCommerce filter hook, woocommerce_is_purchasable, I wrote a function to accomplish what I need in my store. The capabilities “buy_wholesale” and “wholesale” were added by another pricing plugin I am using, Pricing Deals for WooCommerce. The function below allows me to keep Wholesale Buyers from buying my non-wholesale products.

    add_filter('woocommerce_is_purchasable', 'bte_wholesale_is_purchasable', 10, 2);
    function bte_wholesale_is_purchasable($purchasable, $product) {
      if (current_user_can('buy_wholesale') || current_user_can('wholesale')) {
        $price_meta_key = 'regular_price';
        $meta_key = '_role_based_price';
        $cRole = front_end_product_pricing::get_current_role();
        if (get_class($product) == 'WC_Product_Variation') {
          $post_id = $product->variation_id;
        } else {
          $post_id = $product->id;
        }
        if (WooCommerce_Role_Based_Price_Simple_Product_Functions::get_status($post_id)) {
          $wcrbp_price = get_post_meta($post_id, $meta_key, true);
          if (isset($wcrbp_price[$cRole]) && !empty($wcrbp_price[$cRole][$price_meta_key])) {
            return true;
          } else {
            return false;
          }
        } else {
          return false;
        }
      } else {
        return true;
      }
    }
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘v2.2 Popup and Add to Cart Visibility Issues’ is closed to new replies.