E
E
Elio Don2021-02-14 17:47:08
WooCommerce
Elio Don, 2021-02-14 17:47:08

How to add another notification when the cart is full?

There is a code that displays a notification if the amount in the basket is less than 5k.

add_action( 'woocommerce_before_cart', 'truemisha_free_shipping_notice' );
 
function truemisha_free_shipping_notice() {
 
  $min_amount = 5000; // укажите здесь минимальную сумму для бесплатной доставки
 
  $current = WC()->cart->get_subtotal();
 
  if ( $current < $min_amount ) { // если в корзине меньше, чем надо
 
    wc_print_notice(
      sprintf(
        '<a href="%s" class="button 1wc-forward">%s</a> %s',
        get_permalink( wc_get_page_id( 'shop' ) ),
        'Смотреть товары',
        'Закажите ещё на ' . wc_price( $min_amount - $current ) . ' чтобы товары были по Мелкооптовым ценам!'
      ),
      'notice'
    );
 
  }
 
}


What to add so that another notification comes out if the amount in the basket is from 5k to 30k?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question