Created
November 29, 2017 23:12
-
-
Save pbrocks/d14289cb5bdfd4b939fe87d81eba81d0 to your computer and use it in GitHub Desktop.
Replacement function this thread https://www.paidmembershipspro.com/forums/topic/seleccionar-pais-para-el-iva/
This file contains hidden or 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
/** | |
* Replacment for lines https://github.com/strangerstudios/pmpro-vat-tax/blob/master/pmpro-vat-tax.php#L530-L570 | |
*/ | |
function pmprovat_pmpro_payment_option_fields( $payment_option_values, $gateway ) { | |
global $pmpro_european_union, $pmpro_vat_by_country; | |
if ( isset( $_REQUEST['pmprovt_seller_country'] ) ) { | |
$seller_country = sanitize_text_field( $_REQUEST['pmprovt_seller_country'] ); | |
update_option( 'pmprovt_seller_country', 'ES' ); | |
} else { | |
$seller_country = get_option( 'pmprovt_seller_country' ); | |
} | |
?> | |
<tr class="pmpro_settings_divider"> | |
<td colspan="2"> | |
<?php _e( 'EU VAT Seller Country', 'pmprovat' ); ?> | |
</td> | |
</tr> | |
<tr> | |
<th scope="row" valign="top"> | |
<label for="pmprovt_seller_country"><?php _e( 'Seller Country', 'pmprovat' ); ?>:</label> | |
</th> | |
<td> | |
<?php | |
$espana = get_option( 'pmprovt_seller_country' ); | |
if ( ! $espana ) { | |
?> | |
<select id="pmprovt_seller_country" name="pmprovt_seller_country"> | |
<?php | |
foreach ( $pmpro_european_union as $abbr => $country ) { | |
?> | |
<option value="<?php echo $abbr; ?>" | |
<?php | |
if ( $abbr == $seller_country ) { | |
?> | |
selected="selected"<?php } ?>><?php echo $country; ?></option> | |
<?php | |
} | |
?> | |
</select> | |
<?php | |
} else { | |
echo ' España & IVA = ' . $pmpro_vat_by_country['ES']; | |
} | |
?> | |
</td> | |
</tr> | |
<?php | |
} | |
add_action( 'pmpro_payment_option_fields', 'pmprovat_pmpro_payment_option_fields', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment