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_filter( | |
'getpaid_invoice_email_recipients', | |
function( $recipients, $email ) { | |
if ( 'completed_invoice' === $email->id ) { | |
$recipients[] = 'accounting@example.com'; | |
} | |
return $recipients; |
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_filter( 'getpaid_invoice_totals_rows', function( $totals, $invoice ) { | |
$discount = $invoice->get_discount_code(); | |
if ( ! empty( $discount ) ) { | |
$totals['discount'] .= ' (' . $discount . ')'; | |
} | |
return $totals; |
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 discount column. | |
add_filter( 'manage_wpi_invoice_posts_columns', function( $columns ) { | |
$columns['discount_code'] = __( 'Discount Code', 'invoicing' ); | |
return $columns; | |
}, 999 ); | |
// Display discount column. | |
add_action( 'manage_wpi_invoice_posts_custom_column', function( $column_name, $post_id ) { |
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 | |
// Give free trials until 2023-09-02. | |
$GLOBALS['wpinv_trial_ends'] = '2023-09-02'; | |
if ( time() < strtotime( $GLOBALS['wpinv_trial_ends'] ) ) { | |
// Allow free trials. | |
add_filter( | |
'wpinv_get_item_is_free_trial', |
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_action( | |
'getpaid_submissions_process_items', | |
function( &$submission ) { | |
/**@var GetPaid_Payment_Form_Submission $submission */ | |
$percent = 5 / 100; // 5% processing fee. | |
$submission->remove_fee( 'Processing Fee' ); | |
$submission->add_fee( |
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 | |
/** | |
* Contains the zone template. | |
* | |
* You can override this template by copying it to your-theme/gpa/zone.php | |
* | |
* @var Adv_Zone_Template $zone The zone to display. | |
*/ | |
defined( 'ABSPATH' ) || exit; |
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_action( | |
'getpaid_subscription_status_changed', | |
function( $subscription ) { | |
$user = $subscription->get_customer(); | |
if ( empty( $user ) ) { | |
return; | |
} | |
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_shortcode( 'gd_qr_code', 'gd_qr_code_shortcode' ); | |
function gd_qr_code_shortcode( $atts ) { | |
$atts = shortcode_atts( | |
array( | |
'url' => '', | |
'size' => '150', | |
'alt' => '', | |
'class' => 'img-responsive', |
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 | |
/** | |
* Creates a custom meta box. | |
* | |
* @param string $post_type Post type. | |
* @param WP_Post $post Post. | |
*/ | |
function prefix_add_meta_box( $post_type, $post ) { |
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 | |
// If next year is not yet here... | |
if ( (int) date( 'Y' ) < 2022 ) { | |
// ... then give a 50% discount on the initial item price... | |
add_filter( 'wpinv_get_initial_item_price', function( $price ) { | |
global $wpdb; | |
// ... unless he/she is not a first time customer. |
NewerOlder