WooCommerce 가입시 비밀번호 강도 (Strength) 변경

우커머스 (WooCommerce) 가 보안에 신경을???

WooCommerce 2.5 이상부터 지원된 우커머스 가입 숏코드를 통해 생성되는 가입폼에 비밀번호가 허접하게 간단하면 가입이 안되게 Password Strength 를 체크하는 기능이 생겼습니다.

개발단계에서 테스트용으로 가입, 로그인 테스트를 할 경우가 빈번히 있는데 그때마다 어려운 비번을 요구하니 귀찮기 그지없더라고요 ㅋ

그래서 우커머스 (WooCommerce)에서 제공하는 필터를 하나 소개하려고 합니다.

functions.php

/** 
 *Reduce the strength requirement on the woocommerce password.
 * 
 * Strength Settings
 * 3 = Strong (default)
 * 2 = Medium
 * 1 = Weak
 * 0 = Very Weak / Anything
 */
function reduce_woocommerce_min_strength_requirement( $strength ) {
    return 2;
}
add_filter( 'woocommerce_min_password_strength', 'reduce_woocommerce_min_strength_requirement' );

활성화된 테마아래의 functions.php 파일을 열어서 위에 코드를 추가 합니다.

리턴값을 0부터 3까지 줄수있는데요 기본으로 3으로 가장 심하게 되어 있습니다. 전 테스트할때는 0으로 해서 제약이 없게 만들고 실서버로 올리기 전에 2 또는 3으로 바꿔주면 땡~

워드프레스 우커머스 – 장바구니 버튼 이름 변경 방법

오늘은 워드프레스(WordPress) 온라인 쇼핑몰 플러그인(Plugin)인 우커머스(WooCommerce)의 장바구니(카트) 버튼 이름을 변경하는 방법을 설명하겠습니다.

상품 아카이브 페이지의 장바구니 버튼명 변경 방법

활성화된 테마 폴더 밑의 functions.php 파일을 사용하시는 에디터툴로 엽니다.

우커머스(WooCommerce) 버전 2.1 이하

add_filter( 'add_to_cart_text', 'my_archive_custom_cart_button_text' );
function my_archive_custom_cart_button_text() {
 
        return __( 'My Button Text', 'woocommerce' );
 
}

우커머스(WooCommerce) 버전 2.1 이상

add_filter( 'woocommerce_product_add_to_cart_text', 'my_archive_custom_cart_button_text' );
function my_archive_custom_cart_button_text() {
 
        return __( 'My Button Text', 'woocommerce' );
 
}

상품 디테일(싱글) 페이지의 장바구니 버튼이름 변경 방법

활성화된 테마 폴더 밑의 functions.php 파일을 사용하시는 에디터툴로 엽니다.

우커머스(WooCommerce) 버전 2.1 이하

add_filter( 'add_to_cart_text', 'my_custom_cart_button_text' );    // < 2.1
function my_custom_cart_button_text() {
 
        return __( 'My Button Text', 'woocommerce' );
 
}

우커머스(WooCommerce) 버전 2.1 이상

add_filter( 'woocommerce_product_single_add_to_cart_text', 'my_custom_cart_button_text' );    // 2.1 +
function my_custom_cart_button_text() {
 
        return __( 'My Button Text', 'woocommerce' );
 
}

상품 아카이브 페이지의 장바구니 상품타입에 따라 버튼이름 변경 방법

활성화된 테마 폴더 밑의 functions.php 파일을 사용하시는 에디터툴로 엽니다.

add_filter( 'woocommerce_product_add_to_cart_text' , 'my_woocommerce_product_add_to_cart_text' );
function my_woocommerce_product_add_to_cart_text() {
	global $product;
	
	$product_type = $product->product_type;
	
	switch ( $product_type ) {
		case 'external':
			return __( 'Buy product', 'woocommerce' );
		break;
		case 'grouped':
			return __( 'View products', 'woocommerce' );
		break;
		case 'simple':
			return __( 'Add to cart', 'woocommerce' );
		break;
		case 'variable':
			return __( 'Select options', 'woocommerce' );
		break;
		default:
			return __( 'Read more', 'woocommerce' );
	}
	
}

오늘은 워드프레스(WordPress)의 장점이라 할 수 있는 기능중의 하나인 필터기능으로 우커머스(WooCommerce)의 장바구니 버튼명을 변경하는 방법에 대해 소개하였습니다. 다음번에도 유용한 팁을 좋은 포스팅으로 찾아뵙겠습니다 ^-^

연관글: 우커머스(WooCommerce) – 페이팔 결제 버튼 텍스트 변경 방법

우커머스, WooCommerce, WordPress – 페이팔 결제 버튼 텍스트 변경

워드프레스(WordPress)는 CMS(Contents Management System)으로 개인 블로그를 쉽게 만들고 컨텐츠를 작성하기 쉽게 사용하기 위해 태어났다. 하지만 근 몇년 동안 우커머스(WooCommerce) 플러그인(plugin)을 설치해서 소규모의 온라인 쇼핑몰을 제작하기 쉽게 되었다.

오늘은 워드프레스(WordPress)에서 제공하는 filter를 이용하는 방법을 소개하려고 한다. 물론 플러그인(plugin) 또는 워드프레스(WordPress)에서 후킹이나 필터링을 제공하지 않는다면 플러그인(plugin) 또는 워드프레스(WordPress) 코어파일을 직접 수정해야만 한다. 이는 플러그인(plugin) 또는 워드프레스(WordPress)가 업데이트가 되었을때 직접 수정한 코드가 지워지기 때문에 플러그인(plugin) 또는 워드프레스(WordPress)를 직접 수정하는 것은 좋지 않은 방법이다.

현재 활성화된 theme 폴더 밑에 functions.php 파일은 연다.

제일 밑에 아래 코드를 삽입하면 끝이다. 물론 위치는 상관없다.

add_filter( 'gettext', 'custom_paypal_button_text', 20, 3 );
function custom_paypal_button_text( $translated_text, $text, $domain ) {
	switch ( $translated_text ) {
		case 'Proceed to PayPal' :
			$translated_text = __( 'NEW BUTTON TEXT', $domain );
			break;
	}
	return $translated_text;
}

하이라이트 된 5번라인에서 NEW BUTTON TEXT를 변경 원하는 내용으로 바꿔주고 저장하면 끝!

연관글: 워드프레스(WordPress) 우커머스(WooCommerce) – 장바구니 버튼 이름 변경 방법