Find Jobs
Hire Freelancers

Fix existing function (or create new one) to store ID of parent product category as custom field on order in woocommerce

£10-20 GBP

Tamamlandı
İlan edilme: yaklaşık 7 yıl önce

£10-20 GBP

Teslimde ödenir
I've got a function which should get the slug of the first line item's parent category when an order is placed. A query is run to get the custom post type which has a matching slug, then the order should be updated with the ID of the matching custom post in a custom field called 'store_id' The function that I'm using is as follows but it's not working. I need it fixing asap! function add_store_id( $order_id){ global $woocommerce; global $post; if ( !$order_id ) return; // Get Category for order $order = new WC_Order($order_id); $items = $order->get_items(); foreach ( $items as $item ) { $product_id = $item['product_id']; $terms = get_the_terms( $product_id, 'product_cat', array( 'parent' => 0 ) ); foreach ( $terms as $term ) { $term = get_term_by("id", $term->parent, "product_cat"); if ($term->parent > 0) { $term = get_term_by("id", $term->parent, "product_cat"); } $cat_obj = get_term($term->term_id, 'product_cat'); $product_cat_slug = $cat_obj->name; break; } //Update order with ID of store. $the_query = new WP_Query(array('post_type'=>'stores','name'=>$product_cat_slug)); while ( $the_query->have_posts() ) : $the_query->the_post(); update_post_meta( $order_id, 'store_id', $post->ID); endwhile; wp_reset_postdata(); } } add_action('woocommerce_checkout_update_order_meta','add_store_id', 10, 2);
Proje No: 13778472

Proje hakkında

18 teklif
Uzaktan proje
Son aktiviteden bu yana geçen zaman 7 yıl önce

Biraz para mı kazanmak istiyorsunuz?

Freelancer'da teklif vermenin faydaları

Bütçenizi ve zaman çerçevenizi belirleyin
Çalışmanız için ödeme alın
Teklifinizin ana hatlarını belirleyin
Kaydolmak ve işlere teklif vermek ücretsizdir
Seçilen:
Kullanıcı Avatarı
Dear Client, Thanks for this opportunity. We have very strong experience in web development with PHP, especially in Wordpress,Joomla,Magento,OsCommerce,framework such as Codeigniter,Zend,Laravel,Cakephp and Yii ,website designing using bootsratp,angular.js,HTML 5,CSS3 and Responsive Designing. I have gone through your all project requirements.I am confident I can meet and exceed your expectations. We believe in continuous communication with the client from start to end so that our client always updated with project [login to view URL] follow a strong project management so that we can deliver quality work within timeline. Here’s some of our sample work: [login to view URL], [login to view URL], [login to view URL],[login to view URL] , [login to view URL],[login to view URL], [login to view URL], [login to view URL], [login to view URL], [login to view URL], [login to view URL], [login to view URL] and many more. We’d love to hear from you :) Thanks & Regards, Priyanka
£13 GBP 1 gün içinde
5,0 (26 değerlendirme)
4,4
4,4
18 freelancer bu proje için ortalama £19 GBP teklif veriyor
Kullanıcı Avatarı
Hello Sir., I am ready to start it.i am highly interested in your project But i have some questions for you. So kindly leave message for me, then i'll discuss it in depth.
£15 GBP 0 gün içinde
5,0 (263 değerlendirme)
7,2
7,2
Kullanıcı Avatarı
Hi, I have very good experience in woocommerce and WordPress customization and can do this for you within hour. please discuss.
£19 GBP 1 gün içinde
4,9 (151 değerlendirme)
6,4
6,4
Kullanıcı Avatarı
will do your work i have more then 6 years exp and able to do this for you just give me work will do it best and quality work ........................................................... i am new here
£18 GBP 1 gün içinde
5,0 (33 değerlendirme)
5,2
5,2
Kullanıcı Avatarı
Hello, How are you? I read your job with interest. I can do this job. I’m an expert Web Developer with more than 5 years experiences on WODRPRESS(“Theme” and “Plugin”), CODEIGNITER, PHP, OOP, MYSQL, MYSQLI, JAVACSRICT, BOOTSTRAP, HTML, HTML5, CSS, RESPONSIVE etc. I'm a full-time freelancer, I can contribute time and energy to the finish your job. I'm always available in freelancer. I'm waiting for your reply, Regards: Amy
£18 GBP 1 gün içinde
4,9 (60 değerlendirme)
4,8
4,8
Kullanıcı Avatarı
Hi! I would be happy to complete this Woo commerce method for you. I'm available to start when you are. Regards, Ku
£20 GBP 0 gün içinde
4,9 (32 değerlendirme)
4,9
4,9
Kullanıcı Avatarı
A proposal has not yet been provided
£28 GBP 2 gün içinde
5,0 (25 değerlendirme)
4,8
4,8
Kullanıcı Avatarı
dear client i can fix it very soon. we have a professional web designer and developer team with the Experience 5 years in HTML, CSS, JS, jQuery, PHP, MySQL. Very experienced team in WordPress , MAgento , wooCommerce , Bootstrap ,Plugins ,API's and its customization. We can discuss any details over chat, Thanks :) Team ims
£13 GBP 1 gün içinde
0,0 (0 değerlendirme)
0,0
0,0
Kullanıcı Avatarı
ya understand your requirement and i have experience in plugin customization and i will solving this problem
£22 GBP 1 gün içinde
0,0 (0 değerlendirme)
0,0
0,0

Müşteri hakkında

   UNITED KINGDOM bayrağı
Ashton Under Lyne, United Kingdom
5,0
4
Ödeme yöntemi onaylandı
Kas 13, 2015 tarihinden bu yana üye

Müşteri Doğrulaması

Teşekkürler! Ücretsiz kredinizi talep etmeniz için size bir bağlantı gönderdik.
E-postanız gönderilirken bir şeyler yanlış gitti. Lütfen tekrar deneyin.
Kayıtlı Kullanıcı İlan Edlien Toplam İş
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Ön izleme yükleniyor
Coğrafik konum için izin verildi.
Giriş oturumunuzun süresi doldu ve çıkış yaptınız. Lütfen tekrar giriş yapın.