woocommerce 쿠폰의 " 프로모션 코드가 있습니까? "레이블을 어떻게 변경 합니까?
인터넷에서 찾은 일부 PHP 코드를 포함하려고 시도했지만 작동하지 않았습니다.
이걸 도와주세요. 또한 form-coupon.php 파일에서 " 프로모션 코드가 있습니까? "를 " 할인을 적용하려면 아래에 회원 코드를 입력하십시오 "로 변경했습니다.
코드는 다음과 같습니다.
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! wc_coupons_enabled() ) {
return;
}
if ( empty( WC()->cart->applied_coupons ) ) {
$info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Please enter your membership code in the coupon to apply discount', 'woocommerce' ) . ' <a href="#" class="showcoupon">' . __( 'Please enter your membership code below to apply discount', 'woocommerce' ) . '</a>' );
wc_print_notice( $info_message, 'notice' );
}
?>
<form class="checkout_coupon" method="post" style="display:none">
<p class="form-row form-row-first">
<input type="text" name="coupon_code" class="input-text" placeholder="<?php esc_attr_e( 'Member Code', 'woocommerce' ); ?>" id="coupon_code" value="" />
</p>
<p class="form-row form-row-last">
<input type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply code', 'woocommerce' ); ?>" />
</p>
<div class="clear"></div>
</form>
`
감사
이 기사를 살펴보고 지침을 따르십시오. 또는 테마 함수 파일에 다음 코드를 붙여 넣으십시오.
function woocommerce_rename_coupon_field_on_cart( $translated_text, $text, $text_domain ) {
// bail if not modifying frontend woocommerce text
if ( is_admin() || 'woocommerce' !== $text_domain ) {
return $translated_text;
}
if ( 'Apply Coupon' === $text ) {
$translated_text = 'Put your text here';
}
return $translated_text;
}
add_filter( 'gettext', 'woocommerce_rename_coupon_field_on_cart', 10, 3 );
그런 다음 '여기에 텍스트 입력'을 변경하십시오.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다