WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Stop users from using coupons? (3 posts)

  1. naikstercom
    Member
    Posted 8 months ago #

    HI,

    How do I disable coupons just for Administrators and keep them active for customers?

    Thank you

    https://wordpress.org/plugins/woocommerce/

  2. Chrome Orange
    Member
    Posted 8 months ago #

    You would need to modify the coupon form so that it doesn't show for admin users

    https://github.com/woothemes/woocommerce/blob/master/templates/cart/cart.php#L116

    and

    https://github.com/woothemes/woocommerce/blob/master/templates/checkout/form-coupon.php#L14

    are the files you would need to modify

    This doc http://docs.woothemes.com/document/template-structure/ will show you how to copy the template file to your theme so you don't lose changes when you upgrade

  3. terrytsang
    Member
    Posted 7 months ago #

    Hi @naikstercom, you can put below code into your them functions.php:

    function hide_coupon_field_admin( $enabled ) {
      if ( is_admin() ) {
        $enabled = false;
      }
    
      return $enabled;
    }
    add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_admin' );

Reply

You must log in to post.

About this Plugin

About this Topic