Hallo,
ich muss die Frage stellen: Warum sollte man so etwas tun?
Ist ein Online-Shop nicht dazu da, etwas zu kaufen und zwar zeitunabhängig?
Ansonsten gibt es hier Lösungsansätze:
https://wordpress.org/support/topic/remove-add-to-cart-buttons-from-product-page?replies=31
Da geb ich dir auch recht ES piaT aber es geht darum das es ein PizzaShop ist und der Lieferservice halt nur bis zu einer bestimmten Uhrzeit gehen soll. Deswegen möchte ich halt das keine Bestellungen mehr ab einer Bestimmten Uhrzeit ausgelöst werden können.
Vielen Dank aber schon mal für deine schnelle Hilfe 🙂
Hallo!
Falls es was kosten darf:
https://woocommerce.com/products/woocommerce-opening-hours/
WooCommerce Opening Hours
$29.00
…can be used to restrict purchases to certain times.
Ideal for stores with timed deliveries, restaurants, take-aways and anyone else who wants to restrict or allow customer choice of ordering and/or delivery times.
[…]
The plugin is fully internationalised (i.e. ready for translations). Current languages available: English, German, Spanish, Bulgarian (we have a website where you can quickly + easily add your own). It will also respect your WordPress timezone and time and date format settings. Tested and compatible with WooCommerce 2.1 onwards (including the latest version)
Keine eigene Erfahrung damit…
Vielen Dank Flower33,
Wir haben uns dann doch für die Kostenfreie Variante entschieden und den Code selber geschrieben was wiederum nicht viel war 🙂
}
date_default_timezone_set('Europe/Berlin');
$order_close_text = 'Bestellung momentan nicht möglich';
$dt = new DateTime();
$current_time = $dt->format('H:i');
$timeOpen = "11:00";
$timeClose = "22:00";
$date1 = DateTime::createFromFormat('H:i', $current_time);
$date2 = DateTime::createFromFormat('H:i', $timeOpen);
$date3 = DateTime::createFromFormat('H:i', $timeClose);
if ($date1 > $date2 && $date1 < $date3)
{
$closed = false;
}else{
$closed = true;
}
Vielleicht kann das jemand gebrauchen und in sein Shop mit einfügen
@rain82k
Danke schön für deine Rückmeldung und das Mitteilen eurer Lösung!
Kleine Anmerkung:
Die oberste geschweifte Klammer im Code ist zu viel, oder?
Ohh jaa… die sollte nicht dahin ^^
Alles klar, danke dir nochmals!