First of all your plugin is really really great! I mean, well done!
I only have one question.
My client use stock quantity for his products and usually stock are very limited number of items.
Is there any way to by pass this quantity for b2b customers? I mean they just need to request a quote but they can't add more than the quantity number in their basket.
Sorry but i just found out that this code causes a problem to my stock status update!
No matter what i do the stock status remain in stock even if the product for the retail customers are out of stock. This is because the product quantity for b2b customers are 9999.
Yes, the way you change the stock status is working.
Try to have a variation with stock quantity 1 item. The Stock status is "in stock" right?
Try now to change the stock quantity to 0 without change the stock status manually to "out of stock" and save the variables. You will see that the stock status remains "in stock" even if you have 0 items.
Hi.
First of all your plugin is really really great! I mean, well done!
I only have one question.
My client use stock quantity for his products and usually stock are very limited number of items.
Is there any way to by pass this quantity for b2b customers? I mean they just need to request a quote but they can't add more than the quantity number in their basket.
Sorry about my english!
thank you
Hi Dimitrios,
Thank you for purchasing our plugin,
You should be able to do that with a custom code snippet added to functions.php (or any snippets plugin).
I wrote the following snippet and it seems to work in my tests.
The snippet above will show the normal stock quantity for B2C users but show 9999 for each item for B2B users.
Hope that works for you,
Kind Regards,
Stefan
Works like a charm.
Thank you so much!
Sorry but i just found out that this code causes a problem to my stock status update!
No matter what i do the stock status remain in stock even if the product for the retail customers are out of stock. This is because the product quantity for b2b customers are 9999.
Is there any solution for that?
thank you so much
Hi Dimitrios,
I can't seem to understand or replicate the problem.
I have done the following tests with the previous snippet:
1)
Item is set to "out of stock".
It appears out of stock for both B2B and for B2C:
2)
Stock quantity: 1
It appears 9999 for B2B:
and 1 for regular users:
3)
Stock quantity 0:
It appears out of stock for both B2B and regular users:
Are you not seeing the same results? Or can you can you explain the issue more please?
Kind Regards,
Stefan
Hi!
Yes, the way you change the stock status is working.
Try to have a variation with stock quantity 1 item. The Stock status is "in stock" right?
Try now to change the stock quantity to 0 without change the stock status manually to "out of stock" and save the variables. You will see that the stock status remains "in stock" even if you have 0 items.
Am i right?
Hi,
1)
I have this:
I only change 1 to 0 and click Update, nothing else.
2) I tested a little more and I think I know what the problem is in your site.
You probably added the snippet in a way that is activated in the backend as well, not just frontend.
It will work if you activate the snippet only in the frontend.
You can do it with the plugin in this article: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/
and choose this option:
SO, i will take this code:
/**
* Show always 9999 quantity for B2B users.
*/
add_filter( 'woocommerce_product_get_stock_quantity' ,'custom_get_stock_quantity', 10, 2 );
add_filter( 'woocommerce_product_variation_get_stock_quantity' ,'custom_get_stock_quantity', 10, 2 );
function custom_get_stock_quantity( $value, $product ) {
// if user is B2B USER
if (get_user_meta(get_current_user_id(), 'b2bking_b2buser', true) === 'yes'){
return 9999;
} else {
return $value;
}
}
from functions.php and put it in a snippet?
Yes, correct. Take the code, and put it in a PHP snippet, with the plugin from this article:
https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/
and run it only on front-end.
Seems to work in my tests
yes of course its working.
I never thought that i need to run this only on front end
once again thank you so much
I didn't realize it either when I sent you the snippet.
Glad to hear it's working now!