이 플러그인은 최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다. 워드프레스의 좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 있을 수 있습니다.

WooCommerce Smart Sale Badge

설명

“WooCommerce Smart Sale Badge” enhances the built-in sale badge by displaying the total saving amount a customer will receive. The plugin works with all the WooCommerce product types – simple and external products will display a badge that says ‘Save $X!’, while variable and grouped products will display ‘Save up to $X!’.

If you would like a more fully featured sale badge enhancement extension then be sure to check out Sale Flash Pro available for purchase from the WooThemes website: http://www.woothemes.com/products/sale-flash-pro/ (Sale Flash Pro was not written by me, but because WooCommerce Smart Sale Badge contains a limited feature set of Sale Flash Pro I will not be adding further features to this plugin).

Usage

Simply install and activate the plugin and you’ll be good to go.

스크린샷

  • The difference between the default and modified sale badges for simple & external products as displayed in the Twenty Twelve theme.

설치

Installing “WooCommerce Smart Sale Badge” can be done either by searching for “WooCommerce Smart Sale Badge” via the “Plugins > Add New” screen in your WordPress dashboard, or by using the following steps:

  1. Download the plugin via WordPress.org
  2. Upload the ZIP file through the ‘Plugins > Add New > Upload’ screen in your WordPress dashboard
  3. Activate the plugin through the ‘Plugins’ menu in WordPress

FAQ

How do I edit/translate the text that appears on the badge?

You can edit or translate the text displayed on the badge using the CodeStyling Localization plugin for WordPress.

My sale badge isn’t displaying correctly – what gives!?

This plugin does not create the sale badge – that work is done by WooCommerce itself and your theme will handle the styling of the badge. All this plugin does is modify the text that appears on the badge, so if your display is wrong then the issue will be related to your theme and not this plugin.

후기

2018년 6월 2일
Exactly what I was looking for. Was scared that it hasn't been updated in a moment but works just fine
2016년 9월 3일 1 reply
this plugin is great! i made small mod to show sale in percent: <?php if ( ! defined( 'ABSPATH' ) ) exit; class WooCommerce_Smart_Sale_Badge { private $dir; private $file; public function __construct( $file ) { $this->dir = dirname( $file ); $this->file = $file; // Handle localisation $this->load_plugin_textdomain(); add_action( 'init', array( &$this, 'load_localisation' ), 0 ); add_filter( 'woocommerce_sale_flash', array( &$this, 'badge_sale_amount' ), 10, 3 ); } public function badge_sale_amount( $message, $post, $product ) { $saving_amount = 0; if ( $product->has_child() ) { // Loop through children if this is a variable product foreach ( $product->get_children() as $child_id ) { $regular_price = get_post_meta( $child_id, '_regular_price', true ); $sale_price = get_post_meta( $child_id, '_sale_price', true ); if( $regular_price != '' && $sale_price != '' && $regular_price > $sale_price ) { $new_saving_amount = $regular_price - $sale_price; // Only display the largest saving amount if( $new_saving_amount > $saving_amount ) { $saving_amount = $new_saving_amount; } } } $button_text = apply_filters("wc_smart_sale_badge_title", __( 'Do', 'wc_smart_sale_badge' ), $product->has_child(), $product); } else { // Fetch prices for simple products $regular_price = get_post_meta( $post->ID, '_regular_price', true ); $sale_price = get_post_meta( $post->ID, '_sale_price', true ); if( $regular_price != '' && $sale_price != '' && $regular_price > $sale_price ) { $saving_amount = $regular_price - $sale_price; } $button_text = apply_filters("wc_smart_sale_badge_title", __( '', 'wc_smart_sale_badge' ), $product->has_child(), $product); } // Only modify badge if saving amount is larger than 0 if( $saving_amount > 0 ) { $saving_price = woocommerce_price( $saving_amount ); $percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 ); $saving_price_r = apply_filters("wc_smart_sale_badge_price", sprintf( __( ' %s!', 'wc_smart_sale_badge' ), $saving_price ), $saving_price, $product); $message = '<span class="onsale">' . $button_text .'-'. $percentage .'%'. '</span>'; } return $message; } public function load_localisation() { load_plugin_textdomain( 'wc_smart_sale_badge' , false , dirname( plugin_basename( $this->file ) ) . '/lang/' ); } public function load_plugin_textdomain() { $domain = 'wc_smart_sale_badge'; $locale = apply_filters( 'plugin_locale' , get_locale() , $domain ); load_textdomain( $domain , WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' ); load_plugin_textdomain( $domain , FALSE , dirname( plugin_basename( $this->file ) ) . '/lang/' ); } }
모든 6 평가 읽기

기여자 & 개발자

“WooCommerce Smart Sale Badge”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

자국어로 “WooCommerce Smart Sale Badge”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.

변경이력

1.1

  • 2014-04-15
  • [NEW] Adding wc_smart_sale_badge_title and wc_smart_sale_badge_price filters. Props @danmorton.
  • [NEW] Adding Russian translation. Props @advokatb.
  • [NEW] Adding localisation template file.

1.0

  • 2013-05-10
  • Initial release!