Skip to content

Instantly share code, notes, and snippets.

View xlplugins's full-sized avatar

XLPlugins xlplugins

View GitHub Profile
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';
}
@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'] ) ) {
@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 / 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 / virtual_and_simple_products_switch_aero_pages.php
Last active December 10, 2021 14:33
Switch Checkout pages for virtual and simple cart products
add_filter( 'wfacp_global_checkout_page_id', function ( $id ) {
$virtual_product_checkout_id=978; // Make new checkout page for only virtual product and assign here
if ( 0 == $id ) {
return $id;
}
if ( WFACP_Common::is_cart_is_virtual() || WFACP_Common::is_cart_is_virtual( true ) ) {
return $virtual_product_checkout_id;
}
return $id;
} );
@xlplugins
xlplugins / conditional-field.php
Created February 21, 2020 07:54
snippet for conditional field in Aerocheckout
<?php
class WFACP_Conditional_field {
private $conditional_field = [];
public function __construct() {
$this->conditional_field = [
'business_delivery' => [
[
'value' => 'checked',
@xlplugins
xlplugins / conditional-field.php
Last active April 14, 2022 13:55
Conditional field for Radio button in Aerocheckout
<?php
class WFACP_Conditional_field {
private $conditional_field = [];
public function __construct() {
$this->conditional_field = [
'user_type' => [
[
<?php
add_filter( 'wfob_product_raw_data', function ( $raw_data, $product ) {
/**
* @var $product WC_Product
*/
$raw_data['regular_price'] = $product->get_regular_price();
$raw_data['price'] = $product->get_price();
return $raw_data;
@xlplugins
xlplugins / Do not assign billing email as username in aerocheckout and allow special character in email
Last active February 23, 2022 07:13
Allow special character in email and Do not assign billing email as username in aerocheckout
add_filter( 'wfacp_assign_email_as_a_username', '__return_false' );
@xlplugins
xlplugins / do-not-print-cart-error-notice-on-checkout.php
Created August 21, 2020 10:32
do not print cart error notice on checkout page
<?php
add_filter( 'wfacp_print_cart_error_notice', '__return_false' );
?>