Hey there, I would like to find out how I can show the stock that is available to our b2b customers, but only show that it is available without the number to our b2c customers. Long ago your support replied to this question on codecanyon with a code snippet that does not seem to work but I will attach it here. I will also attach images with examples as to what I want to try achive.
// check that user is B2C
if (get_user_meta(get_current_user_id(), 'b2bking_b2buser', true) !== 'yes'){ if ( $_product->is_in_stock() ) { $availability['availability'] = __('Available!', 'woocommerce'); } else { $availability['availability'] = __('Out of Stock!', 'woocommerce'); } }
return $availability;
not sure what i am doing wrong but they did say that they did not test the snippet themselves.
I attached screenshots below, currently it is showing the stock quantity for b2b and b2c customers, I want it to show no quantity to the b2c but keep the quantity for b2b.
Hey there, I would like to find out how I can show the stock that is available to our b2b customers, but only show that it is available without the number to our b2c customers. Long ago your support replied to this question on codecanyon with a code snippet that does not seem to work but I will attach it here. I will also attach images with examples as to what I want to try achive.
Here is the snipppet as it was sent to me:
add_filter( ‘woocommerce_get_availability’, ‘wcs_custom_get_availability’, 1, 2); function wcs_custom_get_availability( $availability, $_product ) { }
not sure what i am doing wrong but they did say that they did not test the snippet themselves.
I attached screenshots below, currently it is showing the stock quantity for b2b and b2c customers, I want it to show no quantity to the b2c but keep the quantity for b2b.
Can anyone assist me with this?
Solved, If anyone needs the code, let me know.