1001 Freelance Projects
Latest Projects from Freelance Marketplaces
Today is: 10-May-2024 21:18 GMT
View Project
View this project in detail (Note: you will be redirected to external marketplace)
Project title: Install script in checkout page
Posted by: External project from PeoplePerHour
Started: 14-Jun-2020 15:22 GMT
Description: Hi
I need to customise the script below so that the site can take orders between 11am to 12am (asia/kuala lumpur). It should be only applicable to checkout page (it disables it) outside the operation time.

Script:
// Custom conditional function that checks for parent product categories from a product category slug
function has_parent_term( $product_id, $category_slug ) {

// Convert category term slug to term id
$category_id = get_term_by('slug', $category_slug, 'product_cat')->term_id;
$parent_term_ids = array(); // Initializing

// Loop through the current product category terms to get only parent main category term
foreach( get_the_terms( $product_id, 'product_cat' ) as $term ){
if( $term->parent > 0 ){
$parent_term_ids[] = $term->parent; // Set the parent product category
$parent_term_ids[] = $term->term_id; // (and the child)
} else {
$parent_term_ids[] = $term->term_id;
}
}
return in_array( $category_id, array_unique($parent_term_ids) );
}

// Custom conditional function that checks from a time range
function is_on_time( $start_time, $end_time, $time_zone = 'UTC' ) {
// Set the default time zone (http://php.net/manual/en/timezones.php)
date_default_timezone_set($time_zone);

$from = explode( ':', $start_time ); //
$from_h = isset($from[0]) ? $from[0] : 0; // hours
$from_m = isset($from[1]) ? $from[1] : 0; // minutes
$from_s = isset($from[2]) ? $from[2] : 0; // seconds
$start = mktime( $from_h, $from_m, $from_s, date("m"), date("d"), date("Y"));

$to = explode( ':', $end_time );
$to_h = isset($to[0]) ? $to[0] : 0; // hours
$to_m = isset($to[1]) ? $to[1] : 0; // minutes
$to_s = isset($to[2]) ? $to[2] : 0; // seconds
$end = mktime( $to_h, $to_m, $to_s, date("m"), date("d"), date("Y"));

$now = strtotime("now");

return ( $start >= $now && $end get_cart() as $cart_item ) {
// Check for product category term and parent term
if ( has_parent_term( $cart_item['product_id'], 't-shirts' ) )
$found = true; // category is found
}

// Checking product category and time
if ( $found && ! is_on_time( '6:00', '23:59', 'Europe/Paris' ) ){
// Avoiding checkout displaying a custom error notice
wc_add_notice( __("Sorry too late, time is now off. You are not allowed to checkout", "woocommerce" ), 'error' );
}
}
Project ID: 3007399
Project category:
Project budget:
View this project in detail (Note: you will be redirected to external marketplace)
Last Projects / Browse Projects
  Project Started
Credit Repair Service Website and Logo Creation
Category: Graphic Design, HTML, Logo Design, PHP, Web Design
Budget: $30 - $250 USD
10-May-2024
16:04 GMT
Cartoon Illustrator for Children's Book
Category: Caricature & Cartoons, Concept Design, Graphic Design, Illustration
Budget: $750 - $1500 USD
10-May-2024
16:04 GMT
Social Media Manager & Basic Video Editor -- 2
Category: Facebook Marketing, Social Media Marketing, Social Networking, Twitter, Video Editing
Budget: ₹750 - ₹1250 INR
10-May-2024
16:03 GMT
Image Standardization Expert
Category: Graphic Design, Illustration, Logo Design, Photoshop, Photoshop Design
Budget: $15 - $25 USD
10-May-2024
16:03 GMT
Graphic design
Category: 3D Design, Graphic Design, Illustration, Logo Design, Photoshop
Budget: ₹100 - ₹400 INR
10-May-2024
16:03 GMT
Social Media Manager & Basic Video Editor
Category: Facebook Marketing, Social Media Marketing, Social Networking, Twitter, Video Editing
Budget: ₹750 - ₹1250 INR
10-May-2024
16:02 GMT
Crypto Promotion/Marketing Expert
Category: Cryptocurrency, Digital Marketing, Facebook Marketing, Internet Marketing, Social Media Marketing
Budget: $15 - $25 USD
10-May-2024
16:02 GMT
Customization of Multi-APK WordPress Appyn Theme
Category: CSS, HTML, JavaScript, PHP, WordPress
Budget: $40 - $80 USD
10-May-2024
16:02 GMT
Statistics Tutor needed in Probability & Hypothesis
Category: Mathematics, R Programming Language, SPSS Statistics, Statistical Analysis, Statistics
Budget: $30 - $250 USD
10-May-2024
16:01 GMT
Spiritual Development Workshop Design
Category: Brochure Design, Content Writing, Graphic Design, Illustration, Logo Design
Budget: £250 - £750 GBP
10-May-2024
16:01 GMT
Dynamic Text & Icon Logo Creation
Category: Graphic Design, Icon Design, Illustration, Logo Design, Photoshop
Budget: ₹750 - ₹1250 INR
10-May-2024
16:01 GMT
Montage vidéo tiktok instagram
Category: Video Editing, Video Production, Video Services, Video Upload, Videography
Budget: €8 - €30 EUR
10-May-2024
16:00 GMT
Custom e-commerce product page with unique QR CODE generation web application -- 2
Category: ECommerce, HTML, MySQL, PHP, Shopping Carts
Budget: $250 - $750 USD
10-May-2024
16:00 GMT
Prototype Design Engineer Needed
Category: CAD / CAM, DFM (Design For Manufacturing), Product Design, Prototype Design
Budget: $25 - $50 CAD
10-May-2024
15:59 GMT
Experienced Screenwriter for Engineering YouTube Channel
Category: Article Writing, Content Writing, Copywriting, Fiction, Ghostwriting
Budget: €8 - €30 EUR
10-May-2024
15:59 GMT
Browse All Projects
Projects by Skills ...
Projects for 'android'
Projects for 'ajax'
Projects for 'asp'
Projects for 'aspnet'
Projects for 'cms'
Projects for 'cpp'
Projects for 'csharp'
Projects for 'css'
Projects for 'delphi'
Projects for 'design'
Projects for 'drupal'
Projects for 'excel'
Projects for 'facebook'
Projects for 'flash'
Projects for 'html'
Projects for 'java'
Projects for 'javascript'
Projects for 'joomla'
Projects for 'iphone'
Projects for 'mysql'
Projects for 'photoshop'
Projects for 'php'
Projects for 'python'
Projects for 'ruby'
Projects for 'seo'
Projects for 'sql'
Projects for 'sysadm'
Projects for 'translate'
Projects for 'typing'
Projects for 'twitter'
Projects for 'vbnet'
Projects for 'xml'
Projects for 'wordpress'
Projects for 'writing'
Read RSS feeds ... New!
RSS feed for 'android'
RSS feed for 'ajax'
RSS feed for 'asp'
RSS feed for 'aspnet'
RSS feed for 'cms'
RSS feed for 'cpp'
RSS feed for 'csharp'
RSS feed for 'css'
RSS feed for 'delphi'
RSS feed for 'design'
RSS feed for 'drupal'
RSS feed for 'excel'
RSS feed for 'facebook'
RSS feed for 'flash'
RSS feed for 'html'
RSS feed for 'java'
RSS feed for 'javascript'
RSS feed for 'joomla'
RSS feed for 'iphone'
RSS feed for 'mysql'
RSS feed for 'photoshop'
RSS feed for 'php'
RSS feed for 'python'
RSS feed for 'ruby'
RSS feed for 'seo'
RSS feed for 'sql'
RSS feed for 'sysadm'
RSS feed for 'translate'
RSS feed for 'typing'
RSS feed for 'twitter'
RSS feed for 'vbnet'
RSS feed for 'xml'
RSS feed for 'wordpress'
RSS feed for 'writing'
New!
Проекты на русском
(Projects in Russian)

Long URL:
www.1001freelanceprojects.com
Mobile version:
m.1001fp.com
Copyright © 2005-2022 1001 Freelance Projects