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
// Hook in to Remove Checkout Fields | |
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); | |
function custom_override_checkout_fields( $fields ) { | |
unset($fields['billing']['billing_state']); | |
unset($fields['billing']['billing_address_2']); | |
unset($fields['billing']['billing_city']); | |
unset($fields['billing']['billing_postcode']); | |
unset($fields['billing']['billing_country']); |
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 shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { |
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
/** | |
* Add new field to Checkout | |
*/ | |
// Hook in | |
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_add_tongbian' ); | |
// Our hooked in function - $fields is passed via the filter! | |
function custom_override_checkout_fields_add_tongbian( $fields ) { | |
$fields['billing']['billing_tongbian'] = array( |
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
/* | |
* Reorder Billing Field | |
*/ | |
add_filter( 'woocommerce_checkout_fields', 'reorder_billing_fields'); | |
function reorder_billing_fields($fields) { | |
$order = array( | |
'billing_first_name', | |
'billing_last_name', |
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
function truncateString(str, num) { | |
// Clear out that junk in your trunk | |
var trunStr = ""; | |
if (str.length>num){ //first checking wheter given string needs to truncated | |
if (num>3) { // check whether given num is bigger than 3 or not | |
trunStr = str.slice(0, num-3); //we need to take additional 3 from the ... | |
console.log(trunStr); |
OlderNewer