Intro
All the data used within this class is pulled from the Business Hours tab within Theme Settings.
data()
Return array containing current hours. Hours are stored using a 0 based index.
Parameters
None |
Examples
Basic usage
$hours = StoreHours::data();
// [
// 0 => ['open' => '9:00', 'close' => '23:00', 'closed' => false, 'label' => 'Sunday'],
// // // // 1 => ['open' => '9:00', 'close' => '23:00', 'closed' => false, 'label' => 'Monday'],
// // // // 2 => ['open' => '9:00', 'close' => '23:00', 'closed' => false, 'label' => 'Tuesday'],
// // // // 3 => ['open' => '9:00', 'close' => '23:00', 'closed' => false, 'label' => 'Wednesday'],
// // // // 4 => ['open' => '9:00', 'close' => '23:00', 'closed' => false, 'label' => 'Thursday'],
// // // // 5 => ['open' => '9:00', 'close' => '23:00', 'closed' => false, 'label' => 'Friday'],
// // // // 6 => ['open' => '9:00', 'close' => '23:00', 'closed' => false, 'label' => 'Saturday']
// ]
dayOfWeek()
Return the named day of the week.
Parameters
$day | optional, default is today | 0 based index for day |
$length | optional, default is 999 | String length of week day |
Examples
Basic usage
StoreHours::dayOfWeek(0);
// Sunday
StoreHours::dayOfWeek(1, 3);
// Mon
today()
Return today's hours.
Parameters
None |
Examples
Basic usage
StoreHours::today();
// [
// 'open' => '09:00',
// 'close' => '17:00',
// 'closed' => false,
// 'label' => 'Monday'
// ]
isVisible()
Checks whether the user has set any store hours.
Parameters
None |
Examples
Basic usage
StoreHours::isVisible();
// true