Hi Matheus,
Here is the code that is still working with 2.27.2
// Add the Address and postcode fields
add_action( 'give_fields_donation_form_after_personal_info', function( $group ) {
$group->append(
give_field( 'text', 'address' )
->showInReceipt()
->minLength(2)
->label( __( 'Address' ))
->maxLength(30)
->placeholder('Address - required for Gift Aid donors')
->storeAsDonorMeta()
->helpText( __( 'This field is only required for Gift Aid donors' ) ) //how this is displayed is up to the template, but if the template has help text displayed, this is how to set it.
);
});
add_action( 'give_fields_donation_form_after_personal_info', function( $group ) {
$group->append(
give_field( 'text', 'PostCode' )
->showInReceipt()
->minLength(2)
->label( __( 'Post Code' ))
->maxLength(30)
->placeholder('Post Code - required for Gift Aid donors')
->storeAsDonorMeta()
->helpText( __( 'This field is only required for Gift Aid donors' ) ) //how this is displayed is up to the template, but if the template has help text displayed, this is how to set it.
);
});
// Add checkbox to donation form before credit card field
add_action( 'give_fields_donation_form_before_cc_form', function( $collection ) {
$collection->append(
give_field( 'checkbox', 'ukTax' )
->showInReceipt()
->label( __( 'Gift Aid. Yes, I am a UK Tax Payer and I would like the York Vikings Rotary Club to reclaim the tax on all qualifying donations I have made, as well as any future donations, until I notify them otherwise.' ))
);
});
// Add the ukTax checkbox to donations in the backend
function render_givewp_field_api_fields( $payment_id ) {
$field_name = give_get_meta( $payment_id, 'ukTax', true );
if ( $field_name ) : ?>
<div id="Tax" class="postbox">
<h3 class="handle">This is a Gift Aid donation</h3>
<div class="inside" style="padding-bottom:10px">
</div>
</div>
<?php endif;
}
add_action( 'give_view_donation_details_billing_after', 'render_givewp_field_api_fields', 10, 1 );
and here is the system info report
### WordPress Environment ###
Home URL: https://www.yorkvikingsrotary.org
Site URL: https://www.yorkvikingsrotary.org
WP Version: 6.2.2
WP Multisite: –
WP Memory Limit: 512 MB
WP Debug Mode: –
WP Cron: ?
Language: en_US
Permalink Structure: /%category%/%postname%/
Show on Front: page
Page on Front: York Vikings (#2642)
Page for Posts: News (#17834)
Table Prefix Length: wpiy_
Table Prefix Length: 5
Table Prefix Status: Acceptable
Admin AJAX: Accessible
Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, acf-disabled, refunded, failed, revoked, cancelled, abandoned, processing, preapproval, tribe-ea-success, tribe-ea-failed, tribe-ea-schedule, tribe-ea-pending, tribe-ea-draft, tribe-ignored
### Server Environment ###
Hosting Provider: DBH: localhost, SRV: www.yorkvikingsrotary.org
TLS Connection: Connection uses TLS 1.3
TLS Connection: Probably Okay
Server Info: LiteSpeed
PHP Version: 8.1.18
PHP Post Max Size: 512 MB
PHP Time Limit: 300
PHP Max Input Vars: 8000
PHP Max Upload Size: 512 MB
cURL Version: 7.87.0, OpenSSL/1.1.1p
SUHOSIN Installed: –
Default Timezone is UTC: ?
fsockopen/cURL: ?
SoapClient: ?
DOMDocument: ?
gzip: ?
GD Graphics Library: ?
Multibyte String: ?
Remote Post: ?
Remote Get: ?
### GiveWP Configuration ###
GiveWP Version: 2.29.0
GiveWP Cache: Enabled
Database Updates: All DB Updates Completed.
Database Updates: All Database Migrations Completed.
Database Tables: ? wpiy_give_donors? wpiy_give_donormeta? wpiy_give_comments? wpiy_give_commentmeta? wpiy_give_sessions? wpiy_give_formmeta? wpiy_give_sequential_ordering? wpiy_give_donationmeta? wpiy_give_revenue? wpiy_give_migrations? wpiy_give_log
GiveWP Cache: Enabled
GiveWP Cache: ?New Donation?Donation Receipt?Donation Processing Receipt?New Offline Donation?Offline Donation Instructions?New User Registration?User Registration Information?Donation Note?Email access
Upgraded From: 2.28.0
Test Mode: Disabled
Currency Code: GBP
Currency Position: Before
Decimal Separator: .
Thousands Separator: ,
Success Page: https://www.yorkvikingsrotary.org/donation-confirmation/
Failure Page: https://www.yorkvikingsrotary.org/donation-failed/
Donation History Page: https://www.yorkvikingsrotary.org/donation-history-2/
GiveWP Forms Slug: /donations/
Enabled Payment Gateways: Stripe - Credit Card
Default Payment Gateway: Stripe - Credit Card
PayPal IPN Notifications: N/A
Donor Email Access: Enabled
Stripe Webhook Notifications: May 24, 2023 8:15 am
### Active GiveWP Add-ons ###
### Other Active Plugins ###
Advanced Custom Fields: Font Awesome: by Matt Keys – 4.0.5
Advanced Custom Fields PRO: by Delicious Brains – 6.1.6
ARMember Lite - Membership Plugin: by Repute InfoSystems – 4.0.4
Bearsthemes Addons: by Bearsthemes – 3.0.0
Elementor: by Elementor.com – 3.14.0
Elementor Pro: by Elementor.com – 3.13.2
Google Analytics for WordPress by MonsterInsights: by MonsterInsights – 8.16
Imagify: by Imagify – Optimize Images & Convert WebP – 2.1.1
Kirki Customizer Framework: by Themeum – 4.2.0
ManageWP - Worker: by GoDaddy – 4.9.17
The Events Calendar: by The Events Calendar – 6.1.1
UberMenu 3 - The Ultimate WordPress Mega Menu: by Chris Mavricos, SevenSpark – 3.7.3
Wordfence Security: by Wordfence – 7.9.3
WPCode Lite: by WPCode – 2.0.12
WP Rocket: by WP Media – 3.14
Yoast SEO: by Team Yoast – 20.9
### Inactive Plugins ###
Akismet Anti-Spam: by Automattic – 5.1
Bears Backup: by Bearsthemes – 2.0.0
Hello Dolly: by Matt Mullenweg – 1.7.2
Site Offline: by Chandra Shekhar Sahu – 1.5.6
Smash Balloon Custom Facebook Feed: by Smash Balloon – 4.1.8
### Active MU Plugins ###
ManageWP - Worker Loader: by GoDaddy – 1.0.0
### Theme ###
Name: Alone
Version: 7.5
Author URL: https://themeforest.net/user/bearsthemes/
Child Theme: No – If you're modifying GiveWP on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme
Thanks