Support

Home Forums Event Espresso Premium Remove Tax on events for Ireland (and any other non taxable countries)

Remove Tax on events for Ireland (and any other non taxable countries)

Posted: February 16, 2017 at 2:42 am

Viewing 12 reply threads


VetDynamics

February 16, 2017 at 2:42 am

Hi guys

Our events currently do not remove tax when people are registering from Ireland (and any other non taxable countries). How do we go about setting this up? Cannot see anything in the settings areas.

This is the event: https://www.vetdynamics.co.uk/vet-dynamics-business-bootcamp/

Many thanks.


Josh

  • Support Staff

February 16, 2017 at 9:04 am

Hi there,

You can set up a ticket option that has a price that doesn’t include tax. Then you clearly label that ticket option that it’s only for those registering from Ireland or any other countries where no tax applies.


VetDynamics

February 17, 2017 at 1:45 am

Thanks for getting back to me Josh.

Is that the only way of doing it?


VetDynamics

February 17, 2017 at 2:59 am

Am I able to pay for some 3rd party customisation through you guys to get this working? So the tax is removed once someone selects/enters a different country that does not pay for tax.

Thanks.


Josh

  • Support Staff

February 17, 2017 at 9:38 am

Hi there,

You can contact one of the developers listed here and they can give you a quote. One other approach that could be taken would be only add the tax when the applicable country is selected (as opposed to trying to remove the tax under some circumstances). There’s some example code that shows how to conditionally add tax in this gist:

https://gist.github.com/joshfeck/d4c013dd1b64807fee2e8d4c4d237456


VetDynamics

February 20, 2017 at 4:57 am

Hi Josh,

Thanks for coming back to me.

We have now edited the code you have provided. Where does this code need to be placed in order for it to work? We are using FTP.

Kind regards,
Katie


Josh

  • Support Staff

February 20, 2017 at 8:44 am

You can add custom functions to a functions plugin.


VetDynamics

February 20, 2017 at 9:38 am

I’ve followed this whole process and it still doesn’t look to be working. The standard ‘Country’ field which is produced by the system will not allow me to add another country, so i’m stuck with United Kingdom.

I’ve followed the checkout process by assigning ‘Ireland’ as the country and it still appears to be adding the VAT/TAX to the total.

Here is the code i added as a custom function plugin:

<?php
/**
* PLEASE READ AND FOLLOW ALL INSTRUCTIONS IN CAPS
*
* IN ORDER FOR THIS TO WORK YOU NEED TO ADD A CUSTOM QUESTION
* BY LOGGING INTO THE WORDPRESS ADMIN AND GOING TO :
* Event Espresso > Registration Form
* AND THEN CLICKING ON “Add New Question”
* FOR THIS EXAMPLE CODE I CREATED A QUESTION NAMED “Billing Address Province”
* SET ITS TYPE TO “Dropdown” AND GAVE IT THE FOLLOWING TWO OPTIONS:
* “Ontario”
* “Alberta”
* (THE ANSWER VALUES ARE CASE SENSITIVE)
* THEN SET THE QUESTION TO REQUIRED
*
* BECAUSE THIS QUESTION SHOULD ONLY BE ASKED ONCE PER TRANSACTION
* I ALSO CREATED A QUESTION GROUP CALLED “Billing Contact Info”
* AND ADDED THE “Billing Address Province” QUESTION TO THAT GROUP
*
* THEN ON MY EVENT ( Event Espresso > Events > Edit Event ),
* I CHECKED OFF THE “Billing Address Province” QUESTION GROUP
* IN THE “Questions for Primary Registrant” SIDEBAR METABOX
*
* THIS WAY, ONLY THE PRIMARY REGISTRANT WILL BE ASKED
* TO SELECT A BILLING ADDRESS PROVINCE, WHICH WILL THEN
* CONTROL WHICH CHARGE IS ADDED TO THE TRANSACTION
*
* PLZ SEE ADDITIONAL INSTRUCTIONS IN FUNCTIONS BELOW
*
* bc_ee_determine_whether_to_apply_surcharge
*
* @return void
*/

function bc_ee_determine_whether_to_apply_surcharge() {
// CHANGE $surcharge_QST_ID VALUE TO MATCH THE ID OF YOUR QUESTION
$surcharge_QST_ID = 14;
if ( isset( $_REQUEST[ ‘ee_reg_qstn’ ] ) ) {
foreach ( $_REQUEST[ ‘ee_reg_qstn’ ] as $registrations ) {
if ( ! empty( $registrations ) ) {
foreach ( $registrations as $QST_ID => $response ) {
if ( $QST_ID === $surcharge_QST_ID ) {
switch ( $response ) {
// CHANGE THESE TO EXACTLY MATCH THE ANSWER OPTIONS FOR YOUR QUESTION
// THEN EDIT / ADD / DELETE THE FUNCTIONS BELOW
// WHOSE NAMES MATCH THESE OPTIONS
// YOU CAN ADD NEW OPTIONS, JUST MAKE SURE TO HAVE A CORRESPONDING
// FUNCTION FOR SETTING THE SURCHARGE DETAILS
case ‘United Kingdom’ :
// apply the surcharge
add_filter( ‘FHEE__bc_ee_apply_transaction_surcharge__apply_surcharge’, ‘__return_true’ );
// hook into function below to set surcharge details
add_filter( ‘FHEE__bc_ee_apply_transaction_surcharge__surcharge_details’, ‘ee_united_kingdom_surcharge_details’ );
break;
case ‘Ireland’ :
// apply the surcharge
add_filter( ‘FHEE__bc_ee_apply_transaction_surcharge__apply_surcharge’, ‘__return_true’ );
// hook into function below to set surcharge details
add_filter( ‘FHEE__bc_ee_apply_transaction_surcharge__surcharge_details’, ‘ee_ireland_surcharge_details’ );
break;
}
}
}
}
}
}
}
add_action( ‘AHEE__EE_System__core_loaded_and_ready’, ‘bc_ee_determine_whether_to_apply_surcharge’, 1 );
/**
* EDIT THIS TO HOLD THE DETAILS FOR ONE OF YOUR ANSWER OPTIONS
* @return array
*/
function ee_united_kingdom_surcharge_details() {
return array(
‘name’ => ‘united_kingdom hst’,
‘code’ => ‘united_kingdom-hst’,
‘description’ => ‘united_kingdom hst 20%’,
‘percent’ => 20,
‘taxable’ => true,
);
}
/**
* EDIT THIS TO HOLD THE DETAILS FOR ONE OF YOUR ANSWER OPTIONS
* @return array
*/
function ee_ireland_surcharge_details() {
return array(
‘name’ => ‘ireland hst’,
‘code’ => ‘ireland-hst’,
‘description’ => ‘ireland hst 20%’,
‘percent’ => 20,
‘taxable’ => false,
);
}
/**
* DO NOT EDIT ANYTHING EXCEPT DEFAULT SURCHARGE DETAILS
*
* bc_ee_apply_transaction_surcharge
*
* @param \EE_Checkout $checkout
* @return \EE_Checkout
*/
function bc_ee_apply_transaction_surcharge( EE_Checkout $checkout ) {
// DEFAULT SURCHARGE DETAILS – EDIT THIS
$surcharge_details = apply_filters(
‘FHEE__bc_ee_apply_transaction_surcharge__surcharge_details’,
array(
// name for surcharge that will be displayed
‘name’ => ‘VAT’,
// unique code used to identify surcharge in the db
‘code’ => ‘vat-for-UK’,
// description for line item
‘description’ => ‘vat only for UK’,
// percentage amount
‘percent’ => 20,
// whether or not tax is applied on top of the surcharge
‘taxable’ => false,
)
);
// STOP EDITING
// apply the surcharge ?
if ( ! apply_filters( ‘FHEE__bc_ee_apply_transaction_surcharge__apply_surcharge’, false ) ) {
return $checkout;
}
// verify checkout
if ( ! $checkout instanceof EE_Checkout ) {
return $checkout;
}
// verify cart
$cart = $checkout->cart;
if ( ! $cart instanceof EE_Cart ) {
return $checkout;
}
// verify grand total line item
$grand_total = $cart->get_grand_total();
if ( ! $grand_total instanceof EE_Line_Item ) {
return $checkout;
}
// has surcharge already been applied ?
$existing_surcharge = $grand_total->get_child_line_item( $surcharge_details[ ‘code’ ] );
if ( $existing_surcharge instanceof EE_Line_Item ) {
return $checkout;
}
EE_Registry::instance()->load_helper( ‘Line_Item’ );
$pre_tax_subtotal = EEH_Line_Item::get_pre_tax_subtotal( $grand_total );
$pre_tax_subtotal->add_child_line_item(
EE_Line_Item::new_instance( array(
‘LIN_name’ => $surcharge_details[ ‘name’ ],
‘LIN_desc’ => $surcharge_details[ ‘description’ ],
‘LIN_unit_price’ => 0,
‘LIN_percent’ => $surcharge_details[ ‘percent’ ],
‘LIN_quantity’ => NULL,
‘LIN_is_taxable’ => $surcharge_details[ ‘taxable’ ],
‘LIN_order’ => 0,
‘LIN_total’ => (float) ( $percentage_amount * ( $pre_tax_subtotal->total() / 100 ) ),
‘LIN_type’ => EEM_Line_Item::type_line_item,
‘LIN_code’ => $surcharge_details[ ‘code’ ],
) )
);
$grand_total->recalculate_total_including_taxes();
return $checkout;
}
add_filter( ‘FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout’, ‘bc_ee_apply_transaction_surcharge’ );

See attached images for better understanding.

http://oi67.tinypic.com/2yo2wyr.jpg
http://oi68.tinypic.com/2s0zb6t.jpg

Hope you can help, many thanks for your past help.


Josh

  • Support Staff

February 20, 2017 at 10:21 am

Hi there,

Please do not post images or full excerpts of code here. Instead, you can post them to a github gist or a paste bin, then you can add a link here.

With regards to your comment about not being able to add Ireland as an option for the Country system question, you can actually do that, but you’ll need to go to Event Espresso > General Settings > Countries, then select Ireland, and then you set the option to include Ireland in the drop down lists.


VetDynamics

February 21, 2017 at 1:34 am

Sorry, will remember for future.

I have added the extra country but the code still appears to not be working. I am still charged with sales tax when I go to the checkout with ‘Ireland’ selected.

Are you able to help?


Josh

  • Support Staff

February 21, 2017 at 10:50 am

Of course it will! because your code is telling it to add 20 even if Ireland is selected.

There are a number of mistakes with what you have set up in the code. For example:

function ee_united_kingdom_surcharge_details() {
return array(
‘name’ => ‘united_kingdom hst’,
‘code’ => ‘united_kingdom-hst’,
‘description’ => ‘united_kingdom hst 20%’,
‘percent’ => 20,
‘taxable’ => true,
);

Taxable should be set to false.

then in:

case ‘Ireland’ :
// apply the surcharge
add_filter( ‘FHEE__bc_ee_apply_transaction_surcharge__apply_surcharge’, ‘__return_true’ );

You should change that he callback to __return_false, and remove this code:

add_filter( ‘FHEE__bc_ee_apply_transaction_surcharge__surcharge_details’, ‘ee_ireland_surcharge_details’ );

If you need further help with your PHP customizations, please consider teaming up with a PHP developer.


VetDynamics

February 27, 2017 at 5:11 am

Hi Josh,

our client is struggling to understand why they should have to pay for a developer to write custom code. Surely you must have come across this problem many times with UK customers who are selling in Europe? They are using Infusionsoft on the site which handles the country of origin with no problem at all, so they are confused as to why EventEspresso needs custom code. Also, if we go down the route of custom code, we will have to keep updates in line with yours which is a nightmare to manage.
Please help, the client is getting frustrated and will soon look for alternatives (eg eventbrite)

Your help is much appreciated.

Marcus & Katie


Josh

  • Support Staff

February 27, 2017 at 7:42 am

Hi Marcus and Katie,

The reason your client needs a custom solution is because Event Espresso does not have a built-in, plug and play feature that removes taxes based on location. It’s possible to add this by using the example code and its documentation, but the solution does need to be put into place by a profession web developer.

Do you have a web developer on your team that you work with? If not, then that’s something you can communicate with to your clients to help alleviate the confusion about what needs to be done here.

Please note that the customizations you add will be in their own plugin and in most cases will not need to be updated when you update Event Espresso.

If you have any more specific questions about how to set up the custom code from the example, please ask, we’re here to help.

Viewing 12 reply threads

The support post ‘Remove Tax on events for Ireland (and any other non taxable countries)’ 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