Wholesale Discount With Price Strike Through in WooCommerce

The code in this download folder enables the storeowner to discount WooCommerce products based on the wholesale user role.

  • This code defines a function called add_wholesale_user_role using the add_role function. It creates a new user role named “wholesale” with the display name “Wholesale Customer.”
  • This code defines a function that modifies the displayed price for wholesale users.
  • It checks if the user is logged in and has the “wholesale” role using is_user_logged_in() and current_user_can( 'wholesale' ).
  • If the conditions are met, it calculates a discounted price based on a specified percentage discount.
  • The original price is displayed crossed out with the discounted price shown beside it.

Installation

There’s only 1 step :

Copy and paste the code to the end of your child themes functions file or custom/functionality plugin.

Download Folder

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.