Title: Coupon codes
Last modified: January 21, 2018

---

# Coupon codes

 *  Resolved [dennisemaar](https://wordpress.org/support/users/dennisemaar/)
 * (@dennisemaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/)
 * I’m using the coupon addon on marketpress, but the screen thing will start turning
   and freezes.
 * How can i fix this?

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Thread Starter [dennisemaar](https://wordpress.org/support/users/dennisemaar/)
 * (@dennisemaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9887278)
 * I have another question. If i’m using the assessment tab in coursepress, and 
   i’m grading with feedback, i can’t submit the grading with feedback. I can only
   grade without feedback.
 * I know this isn’t the coursepress plugin page:)
 *  Plugin Support [Imran – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support9/)
 * (@wpmudev-support9)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9888546)
 * Hello [@dennisemaar](https://wordpress.org/support/users/dennisemaar/)
 * I’ve tested Coupon add-on from y end and could not reproduce an issue. Please
   share here URL link to your site; let us know what PHP version your site is running.
 * Please check if a coupon can be added when all other plugins deactivated, except
   MarketPress. If all is well, start activating one plugin at the time, while testing
   if a coupon can be added, till you find a plugin that can cause a conflict.
 * >  If i’m using the assessment tab in coursepress, and i’m grading with feedback,
   > i can’t submit the grading with feedback. I can only grade without feedback.
 * I could not also reproduce the issue with CoursePress plugin. Please follow the
   above steps and check if the grade can be submitted with all other plugins deactivated.
 * Let us know how it went!
 * Cheers,
    Nastia
 *  Thread Starter [dennisemaar](https://wordpress.org/support/users/dennisemaar/)
 * (@dennisemaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9888566)
 * Thanks for the fast response:)
 * Website: [http://www.dennisemaar.nl](http://www.dennisemaar.nl)
    PHP: 7.0
 * You can test the coupon at: [http://dennisemaar.nl/store/advies-over-te-o…ikkelen-gebieden/](http://dennisemaar.nl/store/advies-over-te-o…ikkelen-gebieden/)-
   > Buy now -> with coupon code “ZEVEN”
 * If you enter the wrong code, it will say that it’s wrong.
 * If I deactivate all plugins, the coupon is still not working.
 * For Coursepress, I also tried deactivating all plugins, this is not working.
 * I can’t click the “Save Feedback as Draft” button and I can modify the field 
   of the first feedback field I opened, but if I open another feedback field, I
   can’t input text in this one.
 * Thanks in advance.
 *  Plugin Support [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * (@wpmudev-support8)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9889020)
 * Hey [@dennisemaar](https://wordpress.org/support/users/dennisemaar/),
 * Hope you’re well.
 * I tested MarketPress and CoursePress too and couldn’t replicate the problem. 
   For this reason, maybe our plugins are just conflicting with your theme. Can 
   you try with default WordPress theme?
 * Also, when I go to [http://dennisemaar.nl/store/advies-over-te-o…ikkelen-gebieden/](http://dennisemaar.nl/store/advies-over-te-o…ikkelen-gebieden/)
   this page I am getting a 404 error. Can you check is your website accessible 
   without logging in?
 * About CoursePress if the problem continues and not related with MarketPress integration
   can you open a new thread on its support forum? If it’s related we can stick 
   here.
 * Cheers,
    Oguz
 *  Thread Starter [dennisemaar](https://wordpress.org/support/users/dennisemaar/)
 * (@dennisemaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9889385)
 * I’m sorry, this is the correct link:
 * [http://dennisemaar.nl/store/advies-over-te-ontwikkelen-gebieden/](http://dennisemaar.nl/store/advies-over-te-ontwikkelen-gebieden/)
 * If i am using wordpress theme twenty seventeen, it will not work either.
    -  This reply was modified 8 years, 3 months ago by [dennisemaar](https://wordpress.org/support/users/dennisemaar/).
 *  Thread Starter [dennisemaar](https://wordpress.org/support/users/dennisemaar/)
 * (@dennisemaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9889797)
 * I am moving my domain en hosting to a different company, so the website will 
   be offline till it is moved.
 * I hope this will solve the issue, if it is, I will notice it here, if it is not
   solving it, I will also notice it here:)
 *  Thread Starter [dennisemaar](https://wordpress.org/support/users/dennisemaar/)
 * (@dennisemaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9890694)
 * It is still not working at my new website.
 * Al though my new website is running significantly smoother.
 * The feedback function in coursepress is working now:)
    -  This reply was modified 8 years, 3 months ago by [dennisemaar](https://wordpress.org/support/users/dennisemaar/).
 *  Plugin Support [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * (@wpmudev-support8)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9892937)
 * Hey [@dennisemaar](https://wordpress.org/support/users/dennisemaar/),
 * Hope you’re well.
 * Thank you for working URL. I checked the coupon section and yes you’re right 
   it stuck when you enter the correct coupon. And I can see there is a 500 error
   for ajax request from chrome developer console.
 * To understand what cause this problem we need to check WordPress debug logging
   and PHP debug logging. First of all can you edit wp-config.php file and put these
   codes;
 *     ```
       /* Debug Settings */
       define('WP_DEBUG', true);
       define('WP_DEBUG_LOG', true);
       define('WP_DEBUG_DISPLAY', false);
       /* End of Debug Settings */
       ```
   
 * Then try entering correct coupon one more time(try to replicate issue again).
   Then check wp-content folder. Is there any debug.log file? If yes please share
   the content with us. If no then check the server PHP logs, is there any related
   logs?
 * Cheers,
    Oguz
 *  Thread Starter [dennisemaar](https://wordpress.org/support/users/dennisemaar/)
 * (@dennisemaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9893077)
 * debug.log file:
 * [23-Jan-2018 11:45:01 UTC] PHP Fatal error: Uncaught Error: Call to a member 
   function format() on boolean in /home/dennisem/public_html/wp-content/plugins/
   wordpress-ecommerce/includes/addons/mp-coupons/class-mp-coupon.php:468
    Stack
   trace: #0 /home/dennisem/public_html/wp-content/plugins/wordpress-ecommerce/includes/
   addons/mp-coupons/class-mp-coupons-addon.php(951): MP_Coupon->is_valid() #1 /
   home/dennisem/public_html/wp-includes/class-wp-hook.php(286): MP_Coupons_Addon-
   >ajax_apply_coupon(”) #2 /home/dennisem/public_html/wp-includes/class-wp-hook.
   php(310): WP_Hook->apply_filters(”, Array) #3 /home/dennisem/public_html/wp-includes/
   plugin.php(453): WP_Hook->do_action(Array) #4 /home/dennisem/public_html/wp-admin/
   admin-ajax.php(97): do_action(‘wp_ajax_mp_coup…’) #5 {main} thrown in /home/dennisem/
   public_html/wp-content/plugins/wordpress-ecommerce/includes/addons/mp-coupons/
   class-mp-coupon.php on line 468
 *  Plugin Support [Laura – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support8/)
 * (@wpmudev-support8)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9893293)
 * Hey [@dennisemaar](https://wordpress.org/support/users/dennisemaar/),
 * Hope you’re well.
 * Thank you for the results. Can you replace is_valid function (approximately 451nd
   line) in {wordpress_folder}/wp-content/plugins/marketpress/includes/addons/mp-
   coupons/class-mp-coupon.php file via FTP. Final function should be look like;
 *     ```
       public function is_valid( $action = '' ) {
       	$now      = time();
       	$is_valid = true;
   
       	//Moved to variable as it will be used in many instances
       	$cart_products = $this->get_products( true ) ;
   
       	$coupon_start 			= get_post_meta( $this->ID, 'start_date', true );
       	$coupon_end 			= get_post_meta( $this->ID, 'end_date', true );
   
       	if ( ! $this->exists() ) {
       		$is_valid = false;
       	} elseif ( $this->remaining_uses( false, true ) == 0 ) {
       		$is_valid = false;
       	} elseif ( $now < strtotime( $coupon_start ) ) {
       		$is_valid = false;
       	} elseif ( $this->get_meta( 'has_end_date' ) && ( $now > strtotime( $coupon_end ) ) ) {
       		$is_valid = false;
       	} elseif ( array() == $cart_products) {
       		$is_valid = false;
       	}elseif( ! $this->valid_for_number_of_products( $cart_products ) ){
       		$is_valid = false;
       	}elseif( ! $this->valid_for_login() ){
       		$is_valid = false;
       	}else {
       		if( $action != 'remove_item' ) {
       			if ( $this->get_meta( 'applies_to' ) == 'user' ) {
       				$user = $this->get_meta( 'user' );
   
       				if ( !in_array( get_current_user_id(), $user ) ) {
       					$is_valid = false;
       				}
       			}
   
       			if( ! $this->is_valid_for_combination() ) {
       				$is_valid = false;
       			}
       		}
       	}
               /**
       	 * Filter is coupon is valid
       	 *
       	 * @since 3.0
       	 *
       	 * param bool Is valid?
       	 * param MP_Coupon The current coupon object.
       	 */
   
       	return apply_filters( 'mp_coupon/is_valid', $is_valid, $this );
       }
       ```
   
 * I hope it helps!
 * Cheers,
    Oguz
 *  Thread Starter [dennisemaar](https://wordpress.org/support/users/dennisemaar/)
 * (@dennisemaar)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9893519)
 * Thanks it’s working:):)

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Coupon codes’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wordpress-ecommerce_f7d96b.svg)
 * [MarketPress - WordPress eCommerce](https://wordpress.org/plugins/wordpress-ecommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-ecommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-ecommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-ecommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-ecommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-ecommerce/reviews/)

 * 11 replies
 * 3 participants
 * Last reply from: [dennisemaar](https://wordpress.org/support/users/dennisemaar/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/coupon-codes-11/#post-9893519)
 * Status: resolved