Over 10 years we helping companies reach their financial and branding goals. Onum is a values-driven SEO agency dedicated.

CONTACTS
Web Design

Chia sẻ code tạo mã giảm giá trong trang chi tiết sản phẩm mới nhất 2024

Hướng dẫn sử dụng:

  • Để hiển thị trước hết bạn cần tạo mã giảm giá cho sản phẩm lẻ trong mục Marketing > Coupons
Tạo mã giảm giá cho sản phẩm có id là 21
  • copy code trong file .php dán vào dưới cùng của file functions.php trong thư mục theme hiện tại.
//START coupon in single product

add_action('flatsome_custom_single_product_1', 'lnh_coupon');

add_shortcode('lnh_coupon', 'lnh_coupon');
function lnh_coupon(){

global $product;

$pro_id = $product->id;

$coupons = get_posts( array(

    'posts_per_page'   => -1,

    'post_type'        => 'shop_coupon',

    'post_status'      => 'publish',
) );
foreach ( $coupons as $coupon ){
    $product_ids = get_post_meta( $coupon->ID, 'product_ids', true );
$coup_cats = get_post_meta( $coupon->ID, 'product_categories', true );
$tiep=1;
if ( !empty( $coup_cats )){
$product_cats = wc_get_product_term_ids( $pro_id, 'product_cat' );
foreach( $product_cats as $product_cat ){
if(in_array($product_cat, $coup_cats)) {
lnh_coup_in_sl($coupon);
$tiep=0;
break;
}
}
}
if ( !empty( $product_ids ) && $tiep == 1 ){
$id_list = explode( ',', $product_ids );
foreach( $id_list as $product_id ){
if($product_id == $pro_id){
lnh_coup_in_sl($coupon);
}
}
}
}
?>
 <style>
    .coupon_get {
      display: block;
    }
    .notranslate {
      display: none;
    }
  </style>
<script>
  jQuery(document).ready(function($){
$( ".coupon_plugin__coupon" ).each(function() {  
$(this).click(function(){
$(this).find( ".coupon_get" ).toggle();
$(this).find( ".cp_copy" ).toggle();
$(this).find( ".coupon__copied" ).toggle();
  var textToCopy = $(this).find( ".code_btn" ).data("code");
  var tempInput = $("<input>");
  $("body").append(tempInput);
  tempInput.val(textToCopy).select();
  document.execCommand("copy");
  tempInput.remove();
  console.log('data-code value copied: ' + textToCopy);
});
});
  });
</script>
<?php
}
function lnh_coup_in_sl($coupon){
$code = get_the_title($coupon->ID);
$c = new WC_Coupon($code);$date = new DateTimeImmutable($c->expiry_date);
ob_start();
?>
<div class="coupon_plugin__single plugin_modals-coupon " impr="1" imprevt="1" imprsd="true">
<div class="coupon_plugin__coupon">
<div class="rules__line" style="background: linear-gradient(90deg, #F8A056, #F93E37)">
<div class="rules__first-line" style="color: #ffffff">       
  <span class="condition"><?php echo $c->get_description(); ?></span> <span class="off"><span class="money">
<?php 
if ($c->get_discount_type() == 'percent'){
echo $c->get_amount()."%";
}else { echo "$".$c->get_amount(); }
?>
</span><span> </span> OFF</span>
  <div class="coupon_plugin__coupon-divider"></div>
</div>
<div class="rules__second-line align-items-center justify-content-center">
  <button data-code="<?php echo $code; ?>" data-id="4c8519e7-5c77-4152-acdf-dde55d2ffe83" class="code_btn" type="button" data-activetype="fixed_amount" style="background: #FEE7CD; color: #F94339">   
<span class="coupon_get">GET</span>
<span class="cp_copy notranslate">
  <?php echo $code; ?>
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M6 2v.5H4.5v-1a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-1V11h.5V2H6zM3 14V5h7v9H3zM1.5 4.5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-10z" fill="currentColor"></path></svg>
</span>
<textarea class="coupon_code_value notranslate" style="position:absolute;left:-99999px;"><?php echo $code; ?></textarea>
  </button>
  <div class="coupon__copied notranslate" style="color: #ffffff">Copied</div>
</div>
</div>
<svg class="app-coupon-triangle app-coupon-triangle-0" xmlns="http://www.w3.org/2000/svg" width="106" height="96" viewBox="0 0 106 96" fill="none"><path d="M102.929 68.555c6.833 12.054-1.946 26.985-15.802 26.875l-68.312-.542C4.959 94.778-3.582 79.71 3.441 67.766l34.625-58.89C45.09-3.067 62.41-2.93 69.242 9.125l33.687 59.43z" fill="#fff" fill-opacity=".11"></path></svg>
<svg class="app-coupon-triangle app-coupon-triangle-1" xmlns="http://www.w3.org/2000/svg" width="106" height="96" viewBox="0 0 106 96" fill="none"><path d="M102.929 68.555c6.833 12.054-1.946 26.985-15.802 26.875l-68.312-.542C4.959 94.778-3.582 79.71 3.441 67.766l34.625-58.89C45.09-3.067 62.41-2.93 69.242 9.125l33.687 59.43z" fill="#fff" fill-opacity=".11"></path></svg>
<svg class="app-coupon-triangle app-coupon-triangle-2" xmlns="http://www.w3.org/2000/svg" width="106" height="96" viewBox="0 0 106 96" fill="none"><path d="M102.929 68.555c6.833 12.054-1.946 26.985-15.802 26.875l-68.312-.542C4.959 94.778-3.582 79.71 3.441 67.766l34.625-58.89C45.09-3.067 62.41-2.93 69.242 9.125l33.687 59.43z" fill="#fff" fill-opacity=".11"></path></svg>
</div>
</div>
<?php
$out = ob_get_clean();
echo $out;
}
//END coupon in single product
  • copy css trong file .txt bỏ vào custom css nếu có trong tùy chỉnh hoặc trong file styles.css trong thư mục theme hiện tại
.coupon_plugin__single{
  margin:10px 0;
  max-width:100%;
  width:100%
}
.coupon_plugin__coupon{
  position:relative;
  overflow:hidden;
  padding:4px;
  font-size:12px;
  line-height:1.2;
  border-radius:12px;
  background-color:#ffefde
}
.coupon_plugin__coupon-divider{
  border-left:2px dashed #fee7cd;
  width:0;
  position:absolute;
  right:-1px;
  top:3px;
  bottom:3px;
  z-index:9
}

.coupon_plugin__coupon .rules__line{
  display:flex;
  justify-content:center;
  align-items:stretch;
  border-radius:10px;
  min-height:76px
}
.coupon_plugin__coupon .rules__first-line {
    display: flex;
    width: 100%;
    flex-grow: 3;
    justify-content: center;
    flex-direction: column-reverse;
    min-width: 0;
    padding: 17px;
    padding-left: 24px;
    border-radius: 0 5px 5px 0;
    color: #fff;
    position: relative;
}
@media(max-width: 960px){
  .coupon_plugin__coupon .rules__first-line{
    padding:10px;
    padding-left:20px
  }
}
.coupon_plugin__coupon .rules__first-line::before,.coupon_plugin__coupon .rules__first-line::after{
  content:"";
  position:absolute;
  width:8px;
  height:8px;
  border-radius:50%;
  background-color:#ffefde;
  right:-4px
}
.coupon_plugin__coupon .rules__first-line::before{
  top:-4px
}
.coupon_plugin__coupon .rules__first-line::after{
  bottom:-4px
}
.coupon_plugin__coupon .rules__first-line .off{
  font-size:20px;
  font-weight:500;
  line-height:27px;
  text-shadow:0px 3px 3px rgba(171,98,41,.22)
}
@media(max-width: 960px){
  .coupon_plugin__coupon .rules__first-line .off{
    font-size:18px
  }
}
.coupon_plugin__coupon .rules__first-line .condition{
  font-size:15px;
  font-weight:400;
  line-height:20px
}
@media(max-width: 960px){
  .coupon_plugin__coupon .rules__first-line .condition{
    font-size:13px
  }
}
.coupon_plugin__coupon .rules__first-line .coupon_date{
  display:flex;
  font-size:12px;
  line-height:17px
}
@media(max-width: 960px){
  .coupon_plugin__coupon .rules__first-line .coupon_date{
    font-size:10px;
    line-height:14px
  }
}
.coupon_plugin__coupon .rules__second-line{
  display:flex;
  flex-grow:1;
  justify-content:center;
  align-items:center;
  flex-direction:column-reverse;
  line-height:1.5;
  border-radius:5px 0 0 5px;
  position:relative;
  padding:7px 10px;
  flex-shrink:0
}
.coupon_plugin__coupon .rules__second-line .coupon__copied{
  display:none;
  margin-bottom:4px;
  line-height:16px;
  font-size:12px
}
@media(max-width: 960px){
  .coupon_plugin__coupon .rules__second-line .coupon__copied{
    font-size:12px
  }
}
.coupon_plugin__coupon .rules__second-line .code_btn{
  display:flex;
  align-items:center;
  justify-content:center;
  border:0;
  border-radius:100px;
  cursor:pointer;
  min-width:84px;
  box-shadow:0px 3px 4px 1px rgba(183,41,32,.26);
  outline:none;
  font-weight:bold;
  position:relative;
  padding:0 10px;
  font-size:14px;
  max-width:120px;
  height:-webkit-max-content;
  height:-moz-max-content;
  height:max-content;
  min-height:36px
}
@media(max-width: 960px){
  .coupon_plugin__coupon .rules__second-line .code_btn{
    max-width:110px
  }
}
.coupon_plugin__coupon .rules__second-line .code_btn>span:nth-child(2){
  display:none
}
.coupon_plugin__coupon .rules__second-line .code_btn-show>span:nth-child(1){
  display:none
}
.coupon_plugin__coupon .rules__second-line .code_btn-show>span:nth-child(2){
  display:flex;
  align-items:center;
  word-break:break-all;
  text-align:center;
  line-height:16px
}
@media(max-width: 960px){
  .coupon_plugin__coupon .rules__second-line .code_btn-show>span:nth-child(2){
    font-size:12px
  }
}
.coupon_plugin__coupon .rules__second-line .code_btn-show>span:nth-child(2) svg{
  flex-shrink:0;
  margin-left:6px
}
.coupon_plugin__coupon .rules__second-line .code_btn-show~.coupon__copied{
  display:block
}

.coupon_plugin__coupon .rules__second-line .code_btn i{
  font-size:12px;
  position:absolute;
  top:50%;
  right:6px;
  transform:translateY(-50%)
}
.coupon_plugin__coupon_classic{
  position:relative;
  overflow:hidden;
  font-size:12px;
  line-height:1.2;
  border-radius:4px
}
.coupon_plugin__coupon_classic .rules__line{
  display:flex;
  justify-content:center;
  align-items:stretch;
  background:linear-gradient(90deg, #F89F56, #F94A3B);
  min-height:100px
}
@media(max-width: 960px){
  .coupon_plugin__coupon_classic .rules__line{
    min-height:80px
  }
}

.coupon_plugin__coupon_classic .rules__first-line{
  z-index:10;
  display:flex;
  flex-grow:3;
  justify-content:center;
  flex-direction:column-reverse;
  min-width:168px;
  padding:17px;
  padding-left:24px;
  border-radius:0 5px 5px 0;
  color:#fff;
  position:relative
}
@media(max-width: 960px){
  .coupon_plugin__coupon_classic .rules__first-line{
    padding:10px;
    padding-left:24px;
    padding-right:0px
  }
}
.coupon_plugin__coupon_classic .rules__first-line .off{
  font-size:20px;
  font-weight:500;
  line-height:29px
}
@media(max-width: 960px){
  .coupon_plugin__coupon_classic .rules__first-line .off{
    font-size:18px
  }
}
.coupon_plugin__coupon_classic .rules__first-line .condition{
  font-size:14px;
  font-weight:400;
  line-height:20px
}
@media(max-width: 960px){
  .coupon_plugin__coupon_classic .rules__first-line .condition{
    font-size:13px
  }
}
.coupon_plugin__coupon_classic .rules__first-line .coupon_date{
  display:flex;
  font-size:12px;
  line-height:17px
}
@media(max-width: 960px){
  .coupon_plugin__coupon_classic .rules__first-line .coupon_date{
    font-size:10px;
    line-height:14px
  }
}
.coupon_plugin__coupon_classic .rules__second-line{
  z-index:10;
  display:flex;
  justify-content:center;
  align-items:center;
  flex-direction:column-reverse;
  line-height:1.5;
  border-radius:5px 0 0 5px;
  position:relative;
  flex-shrink:0;
  padding-right:24px
}
@media(max-width: 960px){
  .coupon_plugin__coupon_classic .rules__second-line{
    padding-right:12px
  }
}
.coupon_plugin__coupon_classic .rules__second-line .coupon__copied{
  display:none;
  margin-bottom:4px;
  line-height:16px;
  font-size:12px
}
@media(max-width: 960px){
  .coupon_plugin__coupon_classic .rules__second-line .coupon__copied{
    font-size:12px
  }
}

.coupon_plugin__coupon_classic .rules__second-line .code_btn{
  display:flex;
  align-items:center;
  justify-content:center;
  border:0;
  border-radius:100px;
  cursor:pointer;
  min-width:120px;
  outline:none;
  position:relative;
  padding:0 10px;
  font-size:16px;
  height:-webkit-max-content;
  height:-moz-max-content;
  height:max-content;
  min-height:44px;
  width:192px;
  max-width:192px
}
@media(max-width: 960px){
  .coupon_plugin__coupon_classic .rules__second-line .code_btn{
    max-width:108px;
    width:108px
  }
}
.coupon_plugin__coupon_classic .rules__second-line .code_btn svg{
  flex-shrink:0;
  margin-left:10px
}
.coupon_plugin__coupon_classic .rules__second-line .code_btn>span:nth-child(2){
  display:none
}
.coupon_plugin__coupon_classic .rules__second-line .code_btn>span:nth-child(1){
  display:flex;
  align-items:center;
  word-break:break-all;
  text-align:center;
  line-height:16px
}
@media(max-width: 960px){
  .coupon_plugin__coupon_classic .rules__second-line .code_btn>span:nth-child(1){
    font-size:12px
  }
}
.coupon_plugin__coupon_classic .rules__second-line .code_btn>span:nth-child(1) svg{
  flex-shrink:0;
  margin-left:10px
}

.coupon_plugin__coupon_classic .rules__second-line .code_btn-show>span:nth-child(1){
  display:flex;
  align-items:center;
  word-break:break-all;
  text-align:center;
  line-height:16px
}
@media(max-width: 960px){
  .coupon_plugin__coupon_classic .rules__second-line .code_btn-show>span:nth-child(1){
    font-size:12px
  }
}

.coupon_plugin__coupon_classic .rules__second-line .code_btn-show>span:nth-child(1) svg{

  flex-shrink:0;

  margin-left:10px

}
.coupon_plugin__coupon_classic .rules__second-line .code_btn-show~.coupon__copied{
  display:block
}
.coupon_plugin__coupon_classic .rules__second-line .code_btn i{

  font-size:12px;

  position:absolute;

  top:50%;

  right:6px;

  transform:translateY(-50%)
}

.coupon_plugin__success .modal-content{

  border-radius:4px;

  width:auto;

  background:linear-gradient(135deg, #FF4848, #FF0D7D)

}

.coupon_plugin__success-text{

  color:#fff;

  padding:18px;

  padding-left:120px;

  background-repeat:no-repeat;

  background-size:contain;

  box-shadow:0px 6px 12px 0px rgba(0,0,0,.12)
}

.coupon_plugin__success-text>div:first-child{

  font-weight:bold;

  font-size:18px;

  margin-bottom:5px

}




.coupon_plugin__success-text>div:nth-child(2){

  font-size:16px

}




.coupon_plugin__label{

  font-size:12px;

  color:#ff3c54;

  border:1px solid #ff3c54;

  padding:2px 4px;

  margin:2px 4px 2px 0;

  cursor:pointer;

  font-weight:bold;

  text-transform:uppercase

}




.app-coupon-label{

  position:relative;

  display:flex;

  align-items:center;

  justify-content:space-between;

  padding:0 12px 0 24px;

  box-shadow:0px 2px 10px 1px rgba(0,0,0,.06);

  border-radius:4px;

  margin:10px 0;

  cursor:pointer

}




.app-coupon-label .coupon_plugin__coupon_classic .rules__second-line{

  padding-right:10px

}
.app-coupon-label .coupon_plugin__coupon_classic .rules__second-line .code_btn{
  max-width:140px
}
@media screen and (max-width: 960px){

  .app-coupon-label{

    padding-left:12px
  }
}

.app-coupon-label-title-text{

  margin-left:8px;

  color:#160505;

  font-size:16px
}

.app-coupon-label-title{

  display:flex;

  align-items:center;

  padding:12px 0;

  flex-shrink:0

}

.app-coupon-label .rightWrap{

  display:flex;

  justify-content:flex-end;

  align-items:center

}

.app-coupon-label-items{

  display:flex;

  flex-wrap:wrap;

  justify-content:end;

  max-height:49px;

  overflow:hidden

}




@media screen and (max-width: 1100px)and (min-width: 960px){

  .app-coupon-label-items>.app-coupon-label-item:nth-child(3){

    display:none
  }
}
@media(max-width: 960px){
  .app-coupon-label-items>.app-coupon-label-item:nth-child(3){
    display:none
  }
}
.app-coupon-label .app-coupon-label-item{

  white-space:nowrap;

  text-align:center;

  min-width:50px;

  background-size:100% 100%;

  padding:2px 10px;

  color:#f94339;

  font-size:12px;

  font-weight:500;

  margin-top:12px;

  margin-bottom:12px;

  border:1px solid;

  border-right:4px;

  border-left:4px;

  margin-left:8px;

  line-height:20px

}
.app-coupon-label-icon{

  margin-left:8px

}
.app-coupon-modal{

  display:none;

  flex-direction:column;

  position:absolute;

  right:0;

  z-index:101;

  top:50px;

  border-radius:10px;

  max-height:450px;

  box-shadow:0px 4px 20px 1px rgba(0,0,0,.15),0px 0px 3px 1px rgba(0,0,0,.1);

  width:380px;

  cursor:default

}
@media(max-width: 960px){

  .app-coupon-modal{

    z-index:9999;

    position:fixed;

    top:unset;

    bottom:0;

    width:100vw;

    box-sizing:border-box;

    border-radius:10px 10px 0px 0px

  }

}




.app-coupon-modal-title{

  display:flex;

  justify-content:center;

  align-items:center;

  padding:16px 0;

  font-size:20px;

  font-weight:600

}




.app-coupon-modal-title>.coupon_modal_close_icon{

  position:absolute;

  right:0;

  cursor:pointer;

  padding:16px;

  line-height:1

}




.app-coupon-modal-coupons{

  padding-bottom:8px;

  overflow-y:auto

}




.app-coupon-modal-coupons .coupon_plugin__coupon{

  margin-bottom:8px

}




.app-coupon-modal-coupons .coupon_plugin__coupon_classic{

  margin-bottom:8px

}




.app-coupon-modal-coupons .rules__first-line{

  padding:10px;

  padding-left:20px

}




.app-coupon-modal-coupons .rules__first-line .condition{

  font-size:13px

}




.app-coupon-modal-coupons .rules__second-line{

  flex-grow:0;

  flex-basis:42%

}




.app-coupon-modal-coupons .code_btn-show>span:nth-child(2){

  font-size:12px

}




.app-coupon-modal-close-md{

  display:none

}




@media(max-width: 960px){

  .app-coupon-modal-close-md{

    display:flex;

    align-items:center;

    justify-content:center;

    background-color:#fff8e8;

    padding:16px 10px 24px;

    margin-left:-16px;

    margin-right:-16px

  }




  .app-coupon-modal-close-md .coupon_modal_close_icon{

    width:100%;

    font-size:16px;

    font-weight:500;

    color:#fff;

    line-height:19px;

    background:#f89e56;

    border-radius:30px;

    font-size:16px;

    font-weight:500;

    cursor:pointer;

    text-align:center;

    padding:10px 0

  }

}




.app-coupon-modal-body{

  position:relative;

  display:flex;

  flex-direction:column;

  z-index:1;

  height:100%;

  overflow:hidden;

  padding:0 16px

}




.app-coupon-modal-mask{

  position:fixed;

  top:0;

  left:0;

  right:0;

  bottom:0;

  cursor:default

}




.app-coupon-modal::after{

  content:"";

  display:block;

  border-width:8px 8px 8px 8px;

  border-style:solid;

  border-color:rgba(0,0,0,0) rgba(0,0,0,0) #ffe6ae rgba(0,0,0,0);

  position:absolute;

  right:12px;

  top:-16px

}




@media(max-width: 960px){

  .app-coupon-modal::after{

    display:none

  }

}




.app-coupon-triangle{

  position:absolute

}




.app-coupon-triangle-0{

  top:-78px;

  left:16px;

  transform:rotateZ(146deg)

}




.app-coupon-triangle-1{

  bottom:-66px;

  left:30%;

  transform:rotateZ(45deg)

}




.app-coupon-triangle-2{

  right:26px;

  top:-82px

}




.classic_svg svg{

  position:absolute

}




.classic_svg svg:first-child{

  top:0

}




.classic_svg svg:nth-child(2){

  bottom:0;

  left:30%

}




.classic_svg svg:nth-child(3){

  top:0;

  right:30%

}




.classic_svg svg:last-child{

  right:0;

  top:0

}




.coupon-skeleton .skeleton-content{

  position:relative;

  border-radius:4px;

  border:2px dashed #000;

  color:#000;

  line-height:20px !important;

  text-align:center;

  font-size:14px;

  padding:40px 16px 24px;

  font-weight:500

}




@media(max-width: 960px){

  .coupon-skeleton .skeleton-content{

    font-size:12px;

    padding:40px 8px 12px !important

  }




  .coupon-skeleton .skeleton-content::before{

    font-size:12px

  }

}




.coupon-skeleton .skeleton-content::before{

  content:"Coupon Code";

  position:absolute;

  top:-2px;

  left:-2px;

  padding:8px 12px;

  font-size:14px;

  background-color:#000;

  color:#fff;

  border-radius:4px 0 4px 0;

  text-align:center;

  font-weight:500

}

.plugin_modals__list-icon {

    font-size: 12px;

    cursor: pointer;

    position: absolute;

    right: 9px;

}

.coupon_plugin__coupon button.code_btn {

    margin: 0;

}




html[dir=rtl] .coupon_plugin__coupon-divider{

  left:-1px;

  right:unset

}




html[dir=rtl] .rules__first-line{

  border-radius:5px 0 0 5px

}




html[dir=rtl] .rules__first-line:after{

  left:unset;

  right:-4px;

  background-image:linear-gradient(rgb(255, 248, 227) 4px, transparent 4px, transparent),radial-gradient(8px at 4px 8px, transparent 4px, rgb(255, 248, 227) 4px)

}




html[dir=rtl] .rules__second-line{

  border-radius:0 5px 5px 0

}




html[dir=rtl] .rules__second-line:after{

  left:-4px;

  right:unset;

  background-image:linear-gradient(rgb(255, 248, 227) 4px, transparent 4px, transparent),radial-gradient(8px at 0px 8px, transparent 4px, rgb(255, 248, 227) 4px)

}




body.eva .properties-content,body.hero .properties-content,body.boost .properties-content{

  z-index:1

}




.multi_coupon_card-container .multi_coupon_card{

  display:flex;

  flex-wrap:wrap;

  justify-content:flex-start;

  gap:24px

}




.multi_coupon_card-container .multi_coupon_card-item{

  width:calc((100% - 24px)/2)

}




.multi_coupon_card-container .multi_coupon_card_more{

  margin-top:24px;

  display:none;

  flex-wrap:wrap;

  justify-content:flex-start;

  gap:24px

}




.multi_coupon_card-container .multi_coupon_card_more-item{

  width:calc((100% - 24px)/2)

}




.multi_coupon_card-container .multi_coupon_show-btn{

  cursor:pointer;

  border:1px solid #292929;

  padding:10px;

  line-height:20px;

  font-size:14px;

  font-weight:500;

  width:-webkit-max-content;

  width:-moz-max-content;

  width:max-content;

  margin:0 auto;

  margin-top:24px

}




@media(min-width: 960px){

  .app__coupon_container{

    padding:var(--general-layout-spacing, var(--page-spacing, 40px));

    max-width:var(--general-layout-width, var(--layout-width, var(--page-width, 1000px)));

    margin:0 auto

  }




  .app__coupon_container .coupon_plugin__coupon_classic{

    height:100%

  }




  .app__coupon_container .coupon_plugin__coupon_classic .rules__line{

    height:100%

  }




  .app__coupon_container .coupon_plugin__coupon_classic .code_btn{

    margin-right:14px;

    max-width:200px;

    width:192px;

    height:-webkit-max-content;

    height:-moz-max-content;

    height:max-content;

    min-height:44px

  }




  .app__coupon_container .coupon_plugin__coupon{

    height:100%

  }




  .app__coupon_container .coupon_plugin__coupon .rules__line{

    height:100%

  }




  .app__coupon_container .coupon_plugin__coupon .rules__second-line{

    flex-grow:0;

    flex-basis:40%

  }




  .app__coupon_container .coupon_plugin__coupon .rules__second-line .code_btn{

    max-width:160px

  }

}

.red{

color:red;

}




.plugin_modals__list {

    background: rgba(235,57,27,.04);

    color: #eb391b;

    padding: 9px 12px;

    padding-right: 40px;

    min-height: 46px;

    display: flex;

    justify-content: space-between;

    align-items: center;

    border-radius: 2px;

}

.plugin_modals__list-name li {

    margin: 0;

}

.pdr__rule {

    margin: 10px 0;

    list-style: none;

    line-height: 1.5;

}

.plugin_modals__list-name {

    font-size: 16px;

}

a.product_detail_rebate_list {

    display: inline-flex;

    align-items: start;

    color: #EB391B;

}

.rebate-icon {

    margin-right: 4px;

    padding-top: 4px;

}

.plugin_modals__list-name li {

    margin: 0;

}

.pdr__rule {

    margin: 10px 0;

    list-style: none;

    line-height: 1.5;

}

a.product_detail_rebate_list {

    align-items: center !important;

}

.plugin_modals__list-name {

    font-size: 16px;

    display: flex;

}
  • Dùng shortcode [lnh_coupon] để hiển thị coupon ở vị trí mong muốn hoặc đổi hook flatsome_custom_single_product_1 thành hook mong muốn (hook flatsome_custom_single_product_1 chỉ áp dụng cho theme flatsome đang dùng custom layout – inb mình nếu gặp khó khăn khi đổi hook)
  • Nếu không sử dụng USD bạn muốn đổi đơn vị tiền tệ thành VNĐ có thể sửa dòng 81 file php thành:
}else { echo $c->get_amount()."đ"; }

Hoặc định dạng theo setting của woo:

}else { echo wc_price($c->get_amount()); }

Đoạn css đổi màu giá nếu định dạng theo setting của woo (thêm vào custom css trong admin hoặc style.css trong folder child theme)

span.money .amount { color: #fff; }

 

Hướng dẫn chi tiết:

Author

ngochoang125.hust

Leave a comment

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *