Last active
August 29, 2015 14:11
-
-
Save strangerstudios/09df1c61ce56b15e78c9 to your computer and use it in GitHub Desktop.
Add S&H price based on shipping country given using PMPro and PMPro Shipping.
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
/* | |
Add S&H price based on shipping country given. | |
*/ | |
function sh_pmpro_checkout_level($level) | |
{ | |
//only for level 2 | |
if($level->id != 2) | |
return $level; | |
//check shipping country | |
if(!empty($_REQUEST['sameasbilling'])) | |
$country = $_REQUEST['bcountry']; | |
elseif(!empty($_REQUEST['scountry'])) | |
$country = $_REQUEST['scountry']; | |
else | |
$country = "US"; //assume US | |
if($country == "US") | |
$level->initial_payment = $level->initial_payment + 12.95; | |
else | |
$level->initial_payment = $level->initial_payment + 24.95; | |
return $level; | |
} | |
add_filter('pmpro_checkout_level', 'sh_pmpro_checkout_level'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment