• Resolved vgvr

    (@vgvr)


    is there any code snippet that checks if a product is enabled for wholesale customers?

    for example i found this code shows if the current user is a wholesale user

    wp_get_current_user()->roles[0] == 'wwp_wholesaler'?

    is there anything like that but for a product?

    • This topic was modified 1 year, 6 months ago by vgvr.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @vgvr,

    Thanks for contacting us,

    I hope you are doing well, You can use this line of code.

    $enable_wholesale = get_post_meta($post_id, '_wwp_enable_wholesale_item', true);
    

    the $enable_wholesale will return ‘yes’ if the wholesale is enabled.

    Thanks & Regards

    WP Experts Support Team

    Thread Starter vgvr

    (@vgvr)

    thank you for the fast reply!

    although this variable is empty every time.. both in wholesale and retail-only products.

    keep in mind that i use the pro version of the plugin but their support didn’t help.

    the reason i want to check for that condition is because i want to make the wholesale products visible to retail customers but without the “add to cart button” . so i want to check is the product is wholesale enabled to hide the add to cart button with css

    thank you ??

    Hi @vgvr,

    Thanks for getting back to us, If you are using the PRO version of our plugin so kindly open a support ticket via our website as we are not allowed to provide support on paid versions through this platform.

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘php code to get if product is in wholesale’ is closed to new replies.