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
/* ===================================================== | |
Custom profile field | |
===================================================== */ | |
function modify_contact_methods($profile_fields) { | |
// Add new fields | |
$profile_fields['company_name'] = 'Company Name'; | |
// Remove old fields | |
unset($profile_fields['aim']); |
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_action('woocommerce_after_checkout_validation', 'deny_pobox_postcode'); | |
function deny_pobox_postcode( $posted ) { | |
global $woocommerce; | |
// Put postcode, address 1 and address 2 into an array | |
$check_address = array(); | |
$check_address[] = isset( $posted['shipping_postcode'] ) ? $posted['shipping_postcode'] : $posted['billing_postcode']; | |
$check_address[] = isset( $posted['shipping_address_1'] ) ? $posted['shipping_address_1'] : $posted['billing_address_1']; | |
$check_address[] = isset( $posted['shipping_address_2'] ) ? $posted['shipping_address_2'] : $posted['billing_address_2']; |
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 | |
// Output variations as a list so they look like a single product | |
// Works in theme/woocommerce/single-product/add-to-car/variable.php | |
?> | |
<table class="table table-striped table-hover"> | |
<thead> | |
<tr> | |
<th>Ref #</th> | |
<?php foreach ( $attributes as $name => $options) :?> | |
<th><?php echo $woocommerce->attribute_label($name); ?></th> |
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
// Allow users to login with their e-mail address | |
// source: http://www.benblanco.com | |
function login_with_email_address($username) { | |
$user = get_user_by('email',$username); | |
if(!empty($user->user_login)) | |
$username = $user->user_login; | |
return $username; | |
} | |
add_action('wp_authenticate','login_with_email_address'); | |
function change_username_wps_text($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
// Based on http://wcdocs.woothemes.com/snippets/hide-other-shipping-methods-when-free-shipping-is-available/ | |
// Goes beyond by hiding the default internation shipping too | |
// Hide shipping options 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 | |
*/ |
OlderNewer