Okay
  Public Ticket #2911596
Purchase lists initial Qty
Closed

Comments

  •  2
    AlexB started the conversation

    Hello,

    I would like to have the quantity field on purchase lists to start as 0, no matter the quantity the customer put when they saved that list. In other words, every time a user clicks at "View List", all the products are listed, but the quantity starts at 0, so they will have to manually fill Qty for each line. 

    Thank you in advance

  •   WebWizards replied privately
  •   AlexB replied privately
  •   WebWizards replied privately
  •   AlexB replied privately
  •  1,881
    WebWizards replied

    Glad to hear that worked!

    I don't think it would be a problem with Loco, but I can't guarantee it. I think it depends on the location where you saved the translation when you first made it. 

    Maybe it's best to make a backup of the old plugin, just in case. You could do that with a plugin like WP File Manager and downloading the b2bking folders from wp-content/plugins.

  •  1
    goodvibeinformatik replied

    Hello guys

    Actually I want to do the same in my website. Would you be so kind to share the solution? Thanks!

  •  2
    AlexB replied

    Hey goodvibeinformatik,

    Add the following PHP code to functions.php:

    add_filter('b2bking_purchase_list_start_quantity', function($val){
        return 0;
    }, 10, 1);


    It worked perfectly for me!

  •  1
    goodvibeinformatik replied

    Thank you so much AlexB! The snippet works great, unfortunately if the user checks the list, then adds new products and updates the list, all the products with 0 get deleted from the list.

    I would like to keep the products regarding if the quantity is 0.

  •  1,881
    WebWizards replied

    Hi there,

    And thanks for helping in on this AlexB!

    unfortunately if the user checks the list, then adds new products and updates the list, all the products with 0 get deleted from the list.

    You can solve this by adding 1 additional snippet to the site:

    add_filter('b2bking_purchase_lists_allow_zero_qty', function($val){
        return 1;
    }, 10, 1);

    Seems to work in my tests,

    Kind regards,

    Stefan

  •  1
    goodvibeinformatik replied

    Hello. Thank you for the update.

    I still have the same problem. This is what I do:

    1. Create a list
    2. Navigate to another page
    3. Check the list again. The quantity is 0 in all products (that is Ok)
    4. Add new products to the list and update the list

    Now all the products that has 0 get deleted but I would like to keep them.

    This is why we need this behavior. Clients want to save their favorite products but it is annoying for them to update the quantity for every product in the list every time they make a new purchase, especially when they have dozens of them.

    The clients want to open the list, update the quantity only in the products they want to buy and add to the cart.

  •  1,881
    WebWizards replied

    Hi,

    This seems to work in my tests.

    I have this list with 3 products:

    9553855534.png

    I click on New Line, and I add 1 more product:

    6294993014.png

    I click update list and now I have 4 products:

    5400421934.png



    I have this code in my functions.php:

    add_filter('b2bking_purchase_list_start_quantity', function($val){
        return 0;
    }, 10, 1);
    add_filter('b2bking_purchase_lists_allow_zero_qty', function($val){
        return 1;
    }, 10, 1);
    


    Are you sure you added the other code correctly to the active theme's functions.php?



  •  1
    goodvibeinformatik replied

    Hi

    Yes, I copied and pasted the exact same code and still have the same problem: the items with quantity=0 get deleted from the list when is updated.

    add_filter('b2bking_purchase_list_start_quantity', function($val){
    return 0;
    }, 10, 1);
    add_filter('b2bking_purchase_lists_allow_zero_qty', function($val){
    return 1;
    }, 10, 1);


  •  1,881
    WebWizards replied

    Are you already using the latest version of B2BKing? Currently that's 4.2.70 on CodeCanyon.

    If not, please update - the issue may be that you have an older version where the snippet is not supported yet.


    Otherwise, if you still encounter the issue with the latest version, we'd be happy to look into it directly for you. For that, please open a separate ticket and privately send us your login info for the site or staging clone site.

  •  1
    goodvibeinformatik replied

    Hello

    Yes, updating the plugin solved the problem. Everything works as intended. Thank you!