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 | |
/* From https://www.usps.com/send/official-abbreviations.htm */ | |
$us_state_abbrevs_names = array( | |
'AL'=>'ALABAMA', | |
'AK'=>'ALASKA', | |
'AS'=>'AMERICAN SAMOA', | |
'AZ'=>'ARIZONA', | |
'AR'=>'ARKANSAS', |
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 | |
// rename the "Have a Coupon?" message on the checkout page | |
function woocommerce_rename_coupon_message_on_checkout() { | |
return 'Have a Promo Code?' . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>'; | |
} | |
add_filter( 'woocommerce_checkout_coupon_message', 'woocommerce_rename_coupon_message_on_checkout' ); | |
// rename the coupon field on the checkout page |
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 | |
// rename the coupon field on the cart page | |
function woocommerce_rename_coupon_field_on_cart( $translated_text, $text, $text_domain ) { | |
// bail if not modifying frontend woocommerce text | |
if ( is_admin() || 'woocommerce' !== $text_domain ) { | |
return $translated_text; | |
} |
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 | |
// hide coupon field on cart page | |
function hide_coupon_field_on_cart( $enabled ) { | |
if ( is_cart() ) { | |
$enabled = false; | |
} | |
return $enabled; |
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 | |
// remove Store name from merchant_ref field for First Data Payeezy | |
add_filter( 'wc_payment_gateway_first_data_payeezy_credit_card_get_order_base', function( $order ) { | |
$order->description = sprintf( 'Order #%1$s', $order->get_order_number() ); | |
return $order; | |
}, 1 ); |
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( 'woocommerce_rest_prepare_shop_order_object', function( $response ) { | |
// strip leading woocommerce_ from payment method | |
if ( ! empty( $response->data['payment_method'] ) ) { | |
$response->data['payment_method'] = str_replace( 'woocommerce_first_data_', '', $response->data['payment_method'] ); | |
} | |
return $response; |
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 | |
// force the "securely save to account" checkbox to default to checked | |
function wc_auth_net_cim_save_payment_method_default_checked( $html, $form ) { | |
if ( empty( $html ) || $form->tokenization_forced() ) { | |
return $html; | |
} | |
return str_replace( 'type="checkbox"', 'type="checkbox" checked="checked"', $html ); | |
} |
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 | |
function sv_wc_auth_net_cim_tweak_held_order_status( $order_status, $order, $response ) { | |
if ( 'on-hold' === $order_status && $response instanceof SV_WC_Payment_Gateway_API_Response && $response->transaction_approved() ) { | |
$order_status = 'processing'; | |
} | |
return $order_status; | |
} |
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
// Hide standard shipping option when free shipping is available | |
add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 ); | |
/** | |
* Hide Standard Shipping option when free shipping is available | |
* | |
* @param array $available_methods | |
*/ | |
function hide_standard_shipping_when_free_is_available( $available_methods ) { |
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 | |
/** | |
* FTP with Implicit SSL/TLS Class | |
* | |
* Simple wrapper for cURL functions to transfer an ASCII file over FTP with implicit SSL/TLS | |
* | |
* @category Class | |
* @author Max Rice | |
* @since 1.0 | |
*/ |
NewerOlder