This file contains hidden or 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; | |
$address = ( isset( $posted['shipping_address_1'] ) ) ? $posted['shipping_address_1'] : $posted['billing_address_1']; | |
$postcode = ( isset( $posted['shipping_postcode'] ) ) ? $posted['shipping_postcode'] : $posted['billing_postcode']; | |
$replace = array(" ", ".", ","); | |
$address = strtolower( str_replace( $replace, '', $address ) ); |
This file contains hidden or 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_add_to_cart_button', 'my_function_sample', 10 ); | |
function my_function_sample() { | |
global $product; | |
echo ' <button type="button" onclick="history.back();"> Go back </button> '; | |
} | |
// Did this help? Donate me some BTC: 1BEsm8VMkYhSFJ92cvUYwxCtsfsB2rBfiG |
This file contains hidden or 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_filter( 'woocommerce_output_related_products_args', 'wc_change_number_related_products' ); | |
function wc_change_number_related_products( $args ) { | |
$args['posts_per_page'] = 1; | |
$args['columns'] = 4; //change number of upsells here | |
return $args; | |
} |
This file contains hidden or 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_process_registration_errors', 'validatePasswordReg', 10, 2 ); | |
function validatePasswordReg( $errors, $user ) { | |
// change value here to set minimum required password chars | |
if(strlen($_POST['password']) < 15 ) { | |
$errors->add( 'woocommerce_password_error', __( 'Password must be at least 15 characters long.' ) ); | |
} | |
// adding ability to set maximum allowed password chars -- uncomment the following two (2) lines to enable that | |
//elseif (strlen($_POST['password']) > 16 ) | |
//$errors->add( 'woocommerce_password_error', __( 'Password must be shorter than 16 characters.' ) ); |
This file contains hidden or 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( 'init', 'custom_fix_thumbnail' ); | |
function custom_fix_thumbnail() { | |
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src'); | |
function custom_woocommerce_placeholder_img_src( $src ) { | |
$upload_dir = wp_upload_dir(); | |
$uploads = untrailingslashit( $upload_dir['baseurl'] ); | |
$src = $uploads . '/2012/07/thumb1.jpg'; | |
This file contains hidden or 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_filter( 'default_checkout_billing_country', 'change_default_checkout_country' ); | |
add_filter( 'default_checkout_billing_state', 'change_default_checkout_state' ); | |
function change_default_checkout_country() { | |
return 'XX'; // country code | |
} | |
function change_default_checkout_state() { | |
return 'XX'; // state code | |
} |
This file contains hidden or 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
/* | |
Modify the color styles of the WooCommerce Bookings datepicker calendar. | |
Add any/all of these styles to your theme's custom CSS, but be sure to change | |
the color hex codes to your choice. They're all black here. | |
*/ | |
/* Month header background color */ | |
#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker-header { | |
background-color: #000000; | |
} |
This file contains hidden or 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_filter( 'woocommerce_order_item_permalink', '__return_false' ); |
This file contains hidden or 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_customer_login_form', 'wc_myacc_message' ); | |
function wc_myacc_message() { | |
if ( get_option( 'woocommerce_enable_myaccount_registration' ) == 'yes' ) { | |
?> | |
<div class="woocommerce-info"> | |
<p><?php _e( 'your custom message goes here' ); ?></p> | |
</div> | |
<?php | |
} | |
} |