Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
@xlplugins
xlplugins / username_email_creation.php
Created October 23, 2019 06:23
Allow special cheracter in email address and create username automatically
<?php
add_action( 'wfacp_before_process_checkout_template_loader', function () {
add_action( 'woocommerce_checkout_process', function () {
$instance = WFACP_Core()->template_loader->get_template_ins();
remove_filter( 'woocommerce_checkout_posted_data', [ $instance, 'assign_email_as_a_username' ] );
} );
} );
@xlplugins
xlplugins / Save price rounded off via snippet
Created September 10, 2019 11:40
Save price rounded off via snippet
add_filter( 'wfacp_percentage_number_format', 'change_number_format' );
function change_number_format( $percentage ) {
return number_format( $percentage, 0 );
}
@xlplugins
xlplugins / create-account-in-backhgroung-and-login-at-step-1.php
Last active December 1, 2021 06:48
Create account in background and Login from step 1 of AeroCheckout
<?php
add_action( 'wp_ajax_nopriv_wfacp_custom_create_account', 'wfacp_custom_create_account' );
function wfacp_custom_create_account() {
WFACP_AJAX_Controller::check_nonce();
$resp = [
'msg' => '',
'status' => false,
];
if ( isset( $_POST['data'] ) ) {
add_filter( 'gettext', 'woocommerce_rename_coupon_message_on_checkout' ,10,3);
// rename the coupon field on the checkout page
function woocommerce_rename_coupon_message_on_checkout( $translated_text, $text, $text_domain ) {
// bail if not modifying frontend woocommerce text
if ( is_admin() || 'woocommerce' !== $text_domain ) {
return $translated_text;
} elseif ( 'Apply coupon' === $text ) {
$translated_text = 'Special Code';
}