Find Jobs
Hire Freelancers

find/fix simple error in code

$10-30 USD

Completed
Posted almost 8 years ago

$10-30 USD

Paid on delivery
I am a starting programmer and made a very simple plugin that causes a fatal error when i install it on my live site. (on my testing site offline it does work correctly). I identified a small piece of code that is the cause. I need someone to tell me what is wrong with the code and how I can solve it. Please see the code below: // Hook in add_filter( 'woocommerce_checkout_fields' , 'ggs_custom_override_checkout_fields' ); // Our hooked in function - $fields is passed via the filter! function ggs_custom_override_checkout_fields( $fields ) { if ( hotel_category_in_cart() ){ $fields['billing']['billing_company'] = array( 'label' => __('Room Number', 'woocommerce'), 'placeholder' => _x('', 'placeholder', 'woocommerce'), 'required' => false, 'class' => array('form-row-wide'), 'clear' => true ); unset($fields['billing']['billing_country']); unset($fields['billing']['billing_first_name']); unset($fields['billing']['billing_last_name']); echo '<link href="css/[login to view URL]" rel="stylesheet" type="text/css" />'; } return $fields; } /** * Check if a HOTEL product category is in the cart */ function hotel_category_in_cart() { // Add your special category slugs here $categories = array( 'hotel' ); // Products currently in the cart $cart_ids = array(); // Categories currently in the cart $cart_categories = array(); // Find each product in the cart and add it to the $cart_ids array foreach( WC()->cart->get_cart() as $cart_item_key => $values ) { $cart_product = $values['data']; $cart_ids[] = $cart_product->id; } // Connect the products in the cart w/ their categories foreach( $cart_ids as $id ) { $products_categories = get_the_terms( $id, 'product_cat' ); // Loop through each product category and add it to our $cart_categories array foreach ( $products_categories as $products_category ) { $cart_categories[] = $products_category->slug; } } // If one of the special categories are in the cart, return true. if ( ! empty( array_intersect( $categories, $cart_categories ) ) ) { return true; } else { return false; } }
Project ID: 10372334

About the project

8 proposals
Remote project
Active 8 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hi, I can do this job. I know PHP well. Please message me if you're interested in my work! solarcoder
$16 USD in 1 day
4.9 (6 reviews)
2.7
2.7
8 freelancers are bidding on average $33 USD for this job
User Avatar
Hi, I can do your job but need to make a short chat discussion with you. let me know if possible for you. please let me know. You can check my profile and feedbacks of clients which itself I got from them. Hope they make some small help trust on me for your job. Regards Rina
$66 USD in 1 day
5.0 (54 reviews)
6.4
6.4
User Avatar
Hello, I have gone through your outsourced requirements "find/fix simple error in code" and have analyzed that I have right skills (HTML, PHP, WooCommerce, Wordpress) to execute your esteemed project. I will complete your project asap, LIFETIME error free guarantee and provide 365 days (ONE YEAR) support... ===== Why choose me? ===== 5.0 / 5.0 rating, 100% completion rate, 100% on-time completion, 100% on-budget :) Kindly, check my profile: http://www.freelancer.com/u/BitLabs.html I work smart, hard, and strictly bid only what we can do! No sub-contracting... ever! You will never go wrong choosing me :)
$31 USD in 0 day
5.0 (100 reviews)
5.9
5.9
User Avatar
Hi there - My name is Jhalak. I’ve read your brief and can see that you’d like to build an Website. My team has 4 years experience designing and developing mobile apps and Websites. I would approach your project by starting with wireframes and getting the site completed, before starting the actual development phase. I am highly qualified for this project and would love to speak with you further about taking this project on. If you'd like to view my previous work, take a look at my Freelancer Portfolio. Regards, Jhalak Thanks, Diamond looking forward for your reply.
$25 USD in 1 day
4.8 (52 reviews)
5.1
5.1
User Avatar
Hello, I read your job posting with my complete understanding. I would really appreciate if we could have a small chat session so we can discuss your project in more detail and can finalize it in quick time. Thanks.
$25 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of NETHERLANDS
Amsterdam, Netherlands
5.0
8
Payment method verified
Member since Nov 28, 2013

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.