Created
July 22, 2021 08:45
-
-
Save andrewlimaza/cd0e985634314842690b496fe85769c8 to your computer and use it in GitHub Desktop.
Add Canadian Tax to PMPro checkout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add 13% tax to all Canadian customers checking out for a membership level. | |
* To add this code to your site, please follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function customtax_pmpro_tax_ca($tax, $values, $order) { | |
if ( $_SESSION['bcountry'] == 'CA' || $_REQUEST['bcountry'] == 'CA' ) { | |
$tax = round( (float) $values[price] * 0.13, 2 ); | |
} | |
return $tax; | |
} | |
add_filter( 'pmpro_tax', 'customtax_pmpro_tax_ca', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment