Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
Anytime we have a sale without a coupon being used, I get an error on the email stating implode() invalid argument functions.php
It was not causing this issue, until recently, then I moved the website from one host to another and updated all the plugins.
The email function hooked that display the text
add_action( 'woocommerce_email_order_details', 'display_applied_coupons', 10, 4 );
function display_applied_coupons( $order, $sent_to_admin, $plain_text, $email ) { // Only for admins and when there at least 1 coupon in the order if ( ! $sent_to_admin && count($order->get_items('coupon') ) == 0 ) return; foreach( $order->get_items('coupon') as $coupon ){ $coupon_codes[] = $coupon->get_code(); } // For one coupon if( count($coupon_codes) == 1 ){ $coupon_code = reset($coupon_codes); echo ''.__( 'Coupon Used: ').$coupon_code.''; } // For multiple coupons else { $coupon_codes = implode( ', ', $coupon_codes); echo ''.__( 'Coupons Used: ').$coupon_codes.''; } }
'
If the customer does not use a coupon it either should be blank or state "No Coupon Used" - I am not sure why the multiple coupons area is causing the section when they do not use any coupons.
Instead of it working I keep just getting this invalid argument to implode error
Try to use array_push instead of $coupon_codes[]
$coupon_codes[]
$coupon_codes = array(); foreach( $order->get_items('coupon') as $coupon ){ //$coupon_codes[] = $coupon->get_code(); array_push($coupon_codes,$coupon->get_code());//changes }
some hosts are not supporting [] in array creatation.
[]
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.