Public Ticket #2911596

Purchase lists initial Qty

Closed
Comments
1 Ticket 2
AlexB started the conversation 5 years ago on November 8, 2021 at 10:58am

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

2,762
KingsPlugins replied 5 years ago on November 8, 2021 at 10:34pm

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
1 Ticket 2
AlexB replied 4 years ago on September 7, 2022 at 8:16am

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
1 Ticket 1
goodvibeinformatik replied 4 years ago on September 7, 2022 at 8:33am

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.

2,762
KingsPlugins replied 4 years ago on September 7, 2022 at 1:03pm

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 Ticket 1
goodvibeinformatik replied 4 years ago on September 7, 2022 at 1:45pm

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.

2,762
KingsPlugins replied 4 years ago on September 7, 2022 at 2:49pm

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 Ticket 1
goodvibeinformatik replied 4 years ago on September 14, 2022 at 12:17pm

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);


2,762
KingsPlugins replied 4 years ago on September 14, 2022 at 8:09pm

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.

Sign In