Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add discount code column to order list
function my_pmpro_add_cols_header($order_ids) {
ob_start(); ?>
<th>Discount Code</th><?php
return ob_get_clean();
add_filter('pmpro_orders_extra_cols_header', 'my_pmpro_add_cols_header');
function my_pmpro_add_cols_body($order) {
global $wpdb;
$sql = "SELECT code from bbwp_pmpro_discount_codes as dc INNER JOIN bbwp_pmpro_discount_codes_uses as dcu ON (dcu.code_id = WHERE dcu.order_id=%s";
$discount_code = $wpdb->get_var($wpdb->prepare($sql, $order->id));
ob_start(); ?>
<td><?php echo $discount_code; ?></td>
return ob_get_clean();
add_filter('pmpro_orders_extra_cols_body', 'my_pmpro_add_cols_body');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.