Find Jobs
Hire Freelancers

Help write a piece of PHP

$10-30 USD

ปิดแล้ว
โพสต์ ประมาณ 9 ปีที่ผ่านมา

$10-30 USD

ชำระเงินเมื่อส่งงาน
Woocommerce filter cart and category specific quantity : So basically, I'm trying to filter my cart. I would like the message below displayed if products from the "cuvees" category are at the number of 4,5,7,8,9,10,11,13,14,15,16,17,19,21 in the cart. So far here what I've did but it only works for one value : 7 . Do I need to put an array when I declare the function ? ---------- add_action( 'woocommerce_check_cart_items', 'check_total' ); function check_total() { // Only run in the Cart or Checkout pages if( is_cart() || is_checkout() ) { global $woocommerce, $product; $i=0; //$prod_id_array = array(); //loop through all cart products foreach ( $woocommerce->cart->cart_contents as $product ) : // Set checking if there's y products in cuvees cart total $cart_product_total = 4; // See if any product is from the cuvees category or not if ( has_term( 'cuvees', 'product_cat', $product['product_id'] ) ) : $total_quantity += $product['quantity']; //array_push($prod_id_array, $product['product_id']); endif; endforeach; foreach ( $woocommerce->cart->cart_contents as $product ) : if ( has_term( 'cuvees', 'product_cat', $product['product_id'] ) ) : if( $total_quantity == $cart_product_total && $i == 0 ) { // Display our error message wc_add_notice( sprintf( '<h5 style="letter-spacing:0.5px;color:white;text-align:center;">/!\&nbsp; Une commande de %s bouteilles n&#39;est pas possible&nbsp;! &nbsp; /!\ </h5><br /> <br /><p style="text-align:center;"> L&#39;envoi n&#39;est possible que pour 1 | 2 | 3 | 6 | 12 | 18 | 24 | 30 | 36 | 42 | 48 | 54 | 60 | 72 | 96 | 120 et plus bouteilles.</p>', $cart_product_total, $total_quantity ), 'error' ); } $i++; endif; endforeach; } } __________________
รหัสโปรเจกต์: 7217869

เกี่ยวกับโปรเจกต์

5 ข้อเสนอ
โปรเจกต์ระยะไกล
ใช้งานอยู่ 9 ปีที่ผ่านมา

กำลังมองหาการสร้างรายได้ใช่ไหม?

ประโยชน์ของการประมูลกับ Freelancer

กำหนดงบประมาณและกรอบเวลาของคุณ
รับเงินจากการงานของคุณ
อธิบายข้อเสนอของคุณในภาพรวม
ลงทะเบียนและเสนอราคาฟรี
5 ฟรีแลนซ์กำลังเสนอราคาโดยเฉลี่ย $38 USD สำหรับงานนี้
รูปอวาตาร์ของผู้ใช้
Hello! With 99% completion rate, 750 successfully completed projects, and a 5.00 reputation (maximum possible, 5.0) (Yes, not even 4.99 average rating, can be verified on my profile page https://www.freelancer.com/u/rajeshsonisl.html !!)... you can never go wrong choosing me :) I look forward to your reply. Thanks. Kind Regards, Rajesh Soni
$54 USD ใน 1 วัน
5.0 (999 รีวิว)
8.7
8.7
รูปอวาตาร์ของผู้ใช้
Dear Sir. We claim to get it done perfectly for you EXACTLY in the way you want it - Kindly give we a chance and we will prove myself - Ready to prove our words, let's get it done right away and I mean RIGHT AWAY !! Looking forward to hear from you soon - GOD Bless You.
$54 USD ใน 1 วัน
4.9 (185 รีวิว)
6.8
6.8
รูปอวาตาร์ของผู้ใช้
제안이 아직 제공되지 않았습니다
$25 USD ใน 2 วัน
4.3 (7 รีวิว)
3.2
3.2

เกี่ยวกับลูกค้า

ปักธงของ FRANCE
MAREUIL SUR AY, France
5.0
1
ยืนยันวิธีการชำระเงินแล้ว
เป็นสมาชิกตั้งแต่ ต.ค. 26, 2014

การยืนยันลูกค้า

ขอบคุณ! เราได้ส่งลิงก์สำหรับเครดิตฟรีให้คุณทางอีเมลแล้ว
เกิดข้อผิดพลาดขณะส่งอีเมลของคุณ กรุณาลองอีกครั้ง
โลโก้ Freelancer Thailand / ภาษาไทย ช่วยเหลือและสนับสนุน FreelancerประเภทโปรเจคการประกวดFreelancerองค์กรแพ็กเกจสมาชิกโครงการ Freelancer ชั้นแนวหน้าการจัดการโปรเจคงานในพื้นที่Photo Anywhereหน้าจัดแสดงผลงานAPI สำหรับนักพัฒนาได้รับการยืนยันDesktop App เกี่ยวกับเกี่ยวกับเราวิธีใช้งานความปลอดภัยนักลงทุนแผนผังเว็บไซต์เรื่องราวข่าวออกสื่อทีมรางวัลข่าวประชาสัมพันธ์ร่วมงานกับเรา ข้อกำหนดนโยบายความเป็นส่วนตัวข้อกำหนดและเงื่อนไขนโยบายลิขสิทธิ์ข้อพึงปฏิบัติค่าธรรมเนียมและค่าบริการหุ้นส่วนEscrow.comLoadshiftWarrior Forum แอปโลโก้ Apple App Store โลโก้ Google Play
ไม่สามารถคัดลอกไปยังคลิปบอร์ดได้ โปรดลองอีกครั้งหลังปรับเปลี่ยนการอนุญาต
คัดลอกไปยังคลิปบอร์ดแล้ว
ผู้ใช้ที่ลงทะเบียน งานที่มีการโพสต์ทั้งหมด
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
กำลังโหลดตัวอย่าง
ได้รับอนุญาตสำหรับตำแหน่งทางภูมิศาสตร์
เซสชั่นการเข้าสู่ระบบของคุณหมดอายุและคุณได้ออกจากระบบแล้ว กรุณาเข้าสู่ระบบอีกครั้ง