Skip to content

Instantly share code, notes, and snippets.

@eighty20results
Forked from strangerstudios/pmpro-customizations.php
Last active January 1, 2017 22:47
Show Gist options
  • Save eighty20results/0827329bfac5b4bd90276cd4e15d1212 to your computer and use it in GitHub Desktop.
Save eighty20results/0827329bfac5b4bd90276cd4e15d1212 to your computer and use it in GitHub Desktop.
Tax solution for British Columbia, Canada to be used with Paid Memberships Pro
<?php
/*
Plugin Name: PMPro Custom Tax
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for PMPro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
Tax solution for a fixed tax rate calculation (13%)
Edit as needed, then save this file in your plugins folder and activate it through the plugins page in the WP dashboard.
*/
// Add tax info to cost text.
function customtax_pmpro_tax($tax, $values, $order)
{
$tax = round((float)$values[price] * 0.13, 2);
return $tax;
}
add_filter("pmpro_tax", "customtax_pmpro_tax", 10, 3);
// Add tax specific text to membership level description
function customtax_pmpro_level_cost_text($cost, $level)
{
//only applicable for levels > 1
$cost .= " Members will be charged a 13% tax.";
return $cost;
}
add_filter("pmpro_level_cost_text", "customtax_pmpro_level_cost_text", 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment