Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. function get_Datetime_Now() {
  2.     $tz_object = new DateTimeZone('Europe/Prague');
  3.     //date_default_timezone_set('Brazil/East');
  4.     $datetime = new DateTime();
  5.     $datetime->setTimezone($tz_object);
  6.     return $datetime->format('d.m.Y');
  7. }
  8.  
  9. $date = get_Datetime_Now();
  10. foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
  11.     $_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key);
  12.     $product_id = apply_filters('woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key);
  13.     $plus = $_product->get_shipping_class();
  14.     $date = strtotime($date);
  15.     $date = strtotime("+$plus weekdays", $date);
  16.     $dodani = date('d. m. Y', $date);
  17.     if ($_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters('woocommerce_cart_item_visible', true, $cart_item, $cart_item_key)) {
  18.  
  19.  
  20.         echo "Produkt " . $_product->get_title() . ' musíme doručit do ' . $product->get_shipping_class() . ' dnů (do ' . $dodani . ')';
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement