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( 'wc_password_strength_meter_params', 'my_strength_meter_custom_strings' ); | |
function my_strength_meter_custom_strings( $data ) { | |
$data_new = array( | |
'i18n_password_error' => esc_attr__( 'Come on, enter a stronger password.', 'theme-domain' ), | |
'i18n_password_hint' => esc_attr__( 'The password should be at least seven characters long.', 'theme-domain' ) | |
); | |
return array_merge( $data, $data_new ); | |
} |
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
<?php | |
add_filter('woocommerce_bookings_remind_before_days', function() { | |
return 3; | |
}); |
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_archive_description', 'show_vendor_name_archive', 5 ); | |
function show_vendor_name_archive() { | |
global $wp_query; | |
$term = $wp_query->queried_object; | |
if ( ! is_object( $term ) || empty( $term->term_id ) ) { | |
return; | |
} |
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
<?php | |
add_filter( 'woocommerce_product_single_add_to_cart_text', 'change_add_to_cart_text', 10, 2 ); | |
function change_add_to_cart_text( $default, $product ) { | |
$terms = get_the_terms( $product->id, 'product_cat' ); | |
foreach ( $terms as $term ) { | |
if ( $term->name == 'Posters' ) { | |
$default = __( 'Custom Text', 'domain' ); | |
break; | |
} |
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_order_status_completed', 'change_role_on_purchase' ); | |
function change_role_on_purchase( $order_id ) { | |
$order = wc_get_order( $order_id ); | |
$items = $order->get_items(); | |
$products_to_check = array( '1', '2', '3' ); | |
foreach ( $items as $item ) { | |
if ( $order->user_id > 0 && in_array( $item['product_id'], $products_to_check ) ) { | |
$user = new WP_User( $order->user_id ); |
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
<?php | |
/** | |
* Register term fields for WooCommerce attributes. | |
*/ | |
add_action( 'init', 'register_attributes_url_meta' ); | |
function register_attributes_url_meta() { | |
$attributes = wc_get_attribute_taxonomies(); | |
foreach ( $attributes as $tax ) { | |
$name = wc_attribute_taxonomy_name( $tax->attribute_name ); |
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
/** | |
* Redirect to a specific page when clicking on Continue Shopping in the single product page | |
* | |
* @return void | |
*/ | |
function wc_custom_redirect_continue_shopping( $message ) { | |
if ( strpos( $message, __( 'View Cart', 'woocommerce' ) ) !== false ) { | |
$message = str_replace( esc_url( wc_get_page_permalink( 'cart' ) ), esc_url( wc_get_page_permalink( 'shop' ) ), $message ); | |
$message = str_replace( __( 'View Cart', 'woocommerce' ), esc_html__( 'Continue Shopping', 'woocommerce' ), $message ); |
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
/* Menu color */ | |
#navigation a { | |
color: #ff0000 !important; | |
} | |
/* Product categories widget */ | |
.widget_product_categories a { | |
color: #ff0000 !important; | |
} |
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_order_status_completed', 'change_role_on_purchase' ); | |
function change_role_on_purchase( $order_id ) { | |
$order = wc_get_order( $order_id ); | |
$items = $order->get_items(); | |
$products_to_check = array( '1', '2', '3' ); | |
foreach ( $items as $item ) { | |
if ( $order->user_id > 0 && in_array( $item['product_id'], $products_to_check ) ) { | |
$role = 'new-role'; |
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
/** | |
* Change the Shop archive page title. | |
* @param string $title | |
* @return string | |
*/ | |
function wc_custom_shop_archive_title( $title ) { | |
if ( is_shop() && isset( $title['title'] ) ) { | |
$title['title'] = 'My Title'; | |
} |