Support

Home Forums Event Espresso Premium EE4 discount/promo codes – back end way? LearnDash

EE4 discount/promo codes – back end way? LearnDash

Posted: July 15, 2014 at 7:05 pm

Viewing 16 reply threads


Ray

July 15, 2014 at 7:05 pm

Hi – is there a back-end way of applying the discount/promo codes for EE4 until the functionality get’s built? I’m trying to use EE4 with LearnDash and this is an important function. Thanks.


Dean

July 16, 2014 at 2:50 am

Hi,

You could manually apply a payment to the transaction, thus discounting the overall cost.

If you mark it as a cash payment and use something like ADMIN DISCOUNT for the PO/SO field it will show on their Order Confirmation as a payment made against the purchase.


CMConnection

July 22, 2014 at 3:41 pm

Interesting workaround. I tried it in the sandbox and it works but the PO/SO filed does not show on the receipt email. Is there a way of adding “Discount” to the backend method pulldown. At least until the promo codes are working. Our bookeeper gets cranky if we fudge things together.


Dean

July 23, 2014 at 4:29 am

Hi,

I can certainly make a request for it, but I obviously cannot guarantee it will be added.

Adding it manually would be possible but you would need to edit a core file. Let me know if you want to do that and I can give you the directions.


Ray

July 23, 2014 at 11:58 am

I would love to know how to edit the core files! Just let me know, thanks!


CMConnection

July 25, 2014 at 7:35 am

Yes please.


Dean

July 28, 2014 at 7:45 am

Hi,

Sorry for the delay in responding.

First of all, editing a core file is NOT RECOMMENDED.

I am in a discussion with a developer as to whether we can do something about this by adding a filter hook, or whether will we be waiting until the discount system is ready for EE4.

If you want to continue, it is at your own risk. Back up prior to doing anything.

/wp-content/plugins/event-espresso-4-git/admin_pages/transactions/Transactions_Admin_Page.core.php

Line 636 you will see:

$this->_template_args['payment_methods'] = array(
			'PP' => __( 'PayPal', 'event_espresso' ),
			'CC' => __( 'Credit Card', 'event_espresso' ),
			'CHQ' => __( 'Cheque', 'event_espresso' ),
			'CSH' => __( 'Cash', 'event_espresso' ),
		);

change it to

$this->_template_args['payment_methods'] = array(
			'PP' => __( 'PayPal', 'event_espresso' ),
			'CC' => __( 'Credit Card', 'event_espresso' ),
			'CHQ' => __( 'Cheque', 'event_espresso' ),
			'CSH' => __( 'Cash', 'event_espresso' ),
			'DSC' => __( 'Discount', 'event_espresso' )
		);

and line 799 add

				case 'DSC' :
					$payment['gateway'] = 'Discount';
					$payment['txn_id_chq_nmbr'] = '';
					$payment['gateway_response'] = '';
					break;

This will add a new option. I am not certain that it may affect other aspects of the plugin. If it does, you will need to remove these changes and await the discount system or filter hooks.

As said, this is at your own risk


Brian Colin

July 29, 2014 at 8:13 am

I also request this functionality is added. We got to know EE3 last year and really started to sell it. We’ve installed EE4 a couple places thinking it was an upgrade, and while its a bit easier to navigate, its by far from an upgrade. Too many features have been removed and not having discounts is just one more feature we need desperately.

We’ve stopped selling it and have moved back to online hosted solutions until we see more things like the MailChimp integration get added to EE4.


Josh

  • Support Staff

July 29, 2014 at 11:19 am

Hi Brian,

Thanks for taking the time to leave this valuable feedback.


Ray

August 5, 2014 at 9:33 am

Hi – I tried this but I’m not sure how the discount code actually applies a discount. What I’m trying to do is to apply a discount to the regular price via a code and it shows up in the registration receipt; payment conf, etc. For example, if an event is $100, I’d like to take $20 off w/ a promo/discount-code. Can you help me understand how the code above can make this happen? Thanks.


Tony

  • Support Staff

August 5, 2014 at 9:49 am

Hi Ray,

The code above does not provide that functionality.

Applying a code to a transaction to provide a discount would require all of the functionality of the promo system.

The code above allows you to manually apply a payment to a transaction but allows you to select ‘Discount’ as the payment type.

I think you would be best waiting for the Promo functionality to be included within EE4.


Dean

December 8, 2014 at 4:30 am

HI,

Further to this topic, the developers have advised this will be added into either the 4.4.6 hotfix or 4.5.0 whichever comes first.

In anticipation of this, the following code can be added to your functions.php file or to a site specific plugin ():

function ee_add_discount_option( $options ){
    $options[ 'discount' ] = __( 'Discount', 'event_espresso' );
    return $options;
}
add_filter( 'FHEE__Transactions_Admin_Page__get_payment_methods', 'ee_add_discount_option' );
function ee_handle_discount( $payment_info, $payment_method ){
    $payment_info[ 'gateway' ] = 'discount';
    return $payment_info;
}
add_filter( 'FHEE__Transactions_Admin_Page__apply_payments_or_refunds__unknown_payment_method', 'ee_handle_discount', 10, 2 );

function ee_ensure_discount_is_a_payment_method(){
    if( EE_Maintenance_Mode::instance()->models_can_query() &&
            EE_Registry::instance()->is_model_name( 'Payment_Method' ) &&
            ! EEM_Payment_Method::instance()->exists( array( array( 'PMD_slug' => 'discount' ) ) ) ) {
        $p = EE_Payment_Method::new_instance( array(
            'PMD_type' => 'Admin_Only',
            'PMD_name' => __( 'Discount', 'event_espresso' ),
            'PMD_admin_name' => __( 'Discount', 'event_espresso' ),
            'PMD_slug' => 'discount',
            'PMD_scope' => array( EEM_Payment_Method::scope_admin )
        ));
        $p->save();
    }
}
add_action( 'AHEE__EE_System__core_loaded_and_ready', 'ee_ensure_discount_is_a_payment_method' );

Please note that this won’t do anything until the updates (4.4.6 or 4.5.0) have gone out.

If you need, I can advise how to modify your existing version to accept the above code now. I’ll leave this thread open in case of replies.


b2995

December 16, 2014 at 8:56 am

I just downloaded EE4. Will the upgrade to 4.4.5 / 4.5.0 be pushed down automatically or do I need to do anything else? Discount Codes are also a vital part of our pricing structure. I have several clients I’m trying to deviate from EventBrite. I certainly love having more control over my data and esp the ability to pre-register people, but Discount Codes are vital. With that being said, yes, please post how I can update my code to accept Discount Codes or whatever I need to do…LOL! Thank you!


b2995

December 16, 2014 at 8:59 am

Sorry for the follow-up…I have 4.4.6… So, yes, please post the instructions 😉


Dean

December 17, 2014 at 4:38 am

Hi,

OK, well first off remember that this is only going to add a field to the Payment Type to state discount. This does NOT actually provide a discount.

Discounts are coming for EE4 but they are not ready yet.

OK if you are running 4.4.6 then all you need to do is add the code I outlined above into your themes functions.php or ideally a site specific plugin: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

That’s it, the other code I mentioned was bundled into 4.4.6 so nothing to do there.


Garth

  • Support Staff

May 5, 2015 at 9:52 am

Starting today, current support license holders can opt in to the pre-release channel and download the Event Espresso 4.7 and Promotion add-on pre-releases.

We’d love to get your feedback on some of the new promotion features and changes that we’ve been working on. These include:

  • New interface for managing promocodes
  • Promo code discounts now apply to entire order instead of per ticket
  • Promo code generator
  • Automatic (non-promo-code) discounts
  • Discounts limited by quantity
  • Discounts limited by start date and end date
  • A widget for displaying non-promo-code discounts
  • A shortcode for displaying non-promo-code discounts
Important: The Event Espresso 4 promotions add-on will activate only if Event Espresso 4.7 is active. This means you’ll need to install the Event Espresso 4.7 pre-release before installing the promotions add-on.

If you haven’t already opted into Event Espresso’s pre-release channel, you can go to your account page and check the box to opt in to the pre-release channel. Once you opt in, the download files will be available under the EE4 tab under the Pre Release Downloads heading.

You can find out more information about in the pre-release channel guide.

If you have feedback about Promotions or the 4.7 release, please reply to that Promotions announcement or start another new topic.


Josh

  • Support Staff

August 18, 2015 at 8:12 am

Update: The Promotions add-on for Event Espresso 4 is now available.

Viewing 16 reply threads

The support post ‘EE4 discount/promo codes – back end way? LearnDash’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso