Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function custom_shipping_label_based_on_cart_total($output, $method) {
- $cart_total = WC()->cart->cart_contents_total;
- // SUMA ZA BEZPLATNA DOSTAVKA
- $free_shipping_threshold = 200; //На мястото на 200 напишете сумата за безплатна доставка на вашият магазин!
- if ($cart_total >= $free_shipping_threshold) {
- $output = __('Free Shipping', 'woocommerce');
- } else {
- if ($method->cost > 0) {
- $output = wc_price($method->cost);
- if ($method->get_shipping_tax() > 0) {
- $label = wc_prices_include_tax() ? WC()->countries->ex_tax_or_vat() : WC()->countries->inc_tax_or_vat();
- $output .= ' <small class="tax_label">' . $label . '</small>';
- }
- } else {
- $output = '';
- }
- }
- return $output;
- }
- add_filter('wc_cart_totals_shipping_method_cost', 'custom_shipping_label_based_on_cart_total', 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement