Accueil Forums Support communautaire WooCommerce Entreprise dans l'adresse de facturation

Ce sujet a 3 réponses, 3 participants et a été mis à jour par  Mathieu, il y a 1 mois et 1 semaine.

4 sujets de 1 à 4 (sur un total de 4)
  • Auteur
    Messages
  • #72273

    fraggle435
    Participant

    Bonjour à tous,

     

    Je vous souhaite afficher le nom de l’entreprise des utilisateurs (billing_company) woocommerce dans l’adresse de facturation de la page checkout. Cette donnée est bien renseignée sur la fiche utilisateur et affichée dans les adresses de compte en front.

     

    Il se trouve que dans le formulaire de checkout, il n’y a pas le champs entreprise ( dans le tableau $checkout->get_checkout_fields( ‘billing’ ))

    Je pense que c’est la raison pour laquelle je n’ai pas le nom de l’entreprise dans $order->billing_company

    Quelqu’un a une idée ?

     

    Merci d’avance

    #72448

    Guy
    Modérateur

    Bonjour,

    Je n’ai jamais constaté ce manque, je suppose donc que c’est lié au thème utilisé.

    La doc peut aider: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
    Ou alors le plugin Checkout Field Editor

    #74532

    fraggle435
    Participant

    Merci Guy, je viens d’installer Woo Checkout Field Editor Pro.

    J’aimerais savoir comment récupérer en PHP la valeur d’un champs défini dans ce plugin. Par exemple la valeur “azerty” du champs “_billing_reference_affaire”.

    J’essaye de fouiller dans la variable $order ci-dessous en faisant un “echo $order->meta_data[“2″]->current_data->value; ” sans succès…

    Une idée ??? Merci d’avance.

    Voici le contenu de la variable $order :

    object(WC_Order)#31834 (14) {

    [“status_transition”:protected]=> bool(false) [“data”:protected]=> array(28) {

    [“parent_id”]=> int(0)

    [“status”]=> string(10) “processing”

    [“currency”]=> string(3) “EUR”

    [“version”]=> string(5) “3.4.5”

    [“prices_include_tax”]=> bool(false)

    [“date_created”]=> object(WC_DateTime)#31592 (4) {

    [“utc_offset”:protected]=> int(3600)

    [“date”]=> string(26) “2018-10-31 09:24:42.000000”

    [“timezone_type”]=> int(1)

    [“timezone”]=> string(6) “+00:00”

    }

     

    [“date_modified”]=> object(WC_DateTime)#31952 (4) {

    [“utc_offset”:protected]=> int(3600)

    [“date”]=> string(26) “2018-10-31 09:24:42.000000”

    [“timezone_type”]=> int(1)

    [“timezone”]=> string(6) “+00:00”

    }

     

    [“discount_total”]=> string(1) “0”

    [“discount_tax”]=> string(1) “0”

    [“shipping_total”]=> string(4) “0.00”

    [“shipping_tax”]=> string(1) “0”

    [“cart_tax”]=> string(1) “0”

    [“total”]=> string(5) “25.47”

    [“total_tax”]=> string(1) “0”

    [“customer_id”]=> int(2)

    [“order_key”]=> string(22) “wc_order_5bd974da276b3”

    [“billing”]=> array(11) {

    [“first_name”]=> string(9) “Monprenom”

    [“last_name”]=> string(6) “Monnom”

    [“company”]=> string(0) “”

    [“address_1”]=> string(23) “Mon adresse”

    [“address_2”]=> string(0) “”

    [“city”]=> string(23) “Ma ville”

    [“state”]=> string(0) “”

    [“postcode”]=> string(5) “01010”

    [“country”]=> string(2) “FR”

    [“email”]=> string(22) “monemail@ndd.com”

    [“phone”]=> string(0) “”

    }

     

    [“shipping”]=> array(9) {

    [“first_name”]=> string(9) “Monprenom”

    [“last_name”]=> string(6) “Monnom”

    [“company”]=> string(0) “”

    [“address_1”]=> string(23) “Mon adresse”

    [“address_2”]=> string(0) “”

    [“city”]=> string(23) “ville”

    [“state”]=> string(0) “”

    [“postcode”]=> string(5) “01010”

    [“country”]=> string(2) “FR”

    }

     

    [“payment_method”]=> string(3) “cod”

    [“payment_method_title”]=> string(15) “Lors du retrait”

    [“transaction_id”]=> string(0) “”

    [“customer_ip_address”]=> string(13) “X.X.X.X”

    [“customer_user_agent”]=> string(121) “mozilla/5.0 (macintosh; intel mac os x 10_14_0) applewebkit/537.36 (khtml, like gecko) chrome/69.0.3497.100 safari/537.36”

    [“created_via”]=> string(8) “checkout”

    [“customer_note”]=> string(0) “”

    [“date_completed”]=> NULL

    [“date_paid”]=> NULL

    [“cart_hash”]=> string(32) “8cee87c2c1722aec672ada6931ff9ee7”

    }

     

    [“items”:protected]=> array(0) { }

    [“items_to_delete”:protected]=> array(0) { }

    [“cache_group”:protected]=> string(6) “orders”

    [“data_store_name”:protected]=> string(5) “order”

    [“object_type”:protected]=> string(5) “order”

    [“id”:protected]=> int(6102)

    [“changes”:protected]=> array(0) { }

    [“object_read”:protected]=> bool(true)

    [“extra_data”:protected]=> array(0) { }

    [“default_data”:protected]=> array(28) {

    [“parent_id”]=> int(0)

    [“status”]=> string(0) “”

    [“currency”]=> string(0) “”

    [“version”]=> string(0) “”

    [“prices_include_tax”]=> bool(false)

    [“date_created”]=> NULL

    [“date_modified”]=> NULL

    [“discount_total”]=> int(0)

    [“discount_tax”]=> int(0)

    [“shipping_total”]=> int(0)

    [“shipping_tax”]=> int(0)

    [“cart_tax”]=> int(0)

    [“total”]=> int(0)

    [“total_tax”]=> int(0)

    [“customer_id”]=> int(0)

    [“order_key”]=> string(0) “”

    [“billing”]=> array(11) {

    [“first_name”]=> string(0) “”

    [“last_name”]=> string(0) “”

    [“company”]=> string(0) “”

    [“address_1”]=> string(0) “”

    [“address_2”]=> string(0) “”

    [“city”]=> string(0) “”

    [“state”]=> string(0) “”

    [“postcode”]=> string(0) “”

    [“country”]=> string(0) “”

    [“email”]=> string(0) “”

    [“phone”]=> string(0) “”

    }

     

    [“shipping”]=> array(9) {

    [“first_name”]=> string(0) “”

    [“last_name”]=> string(0) “”

    [“company”]=> string(0) “”

    [“address_1”]=> string(0) “”

    [“address_2”]=> string(0) “”

    [“city”]=> string(0) “”

    [“state”]=> string(0) “”

    [“postcode”]=> string(0) “”

    [“country”]=> string(0) “”

    }

     

    [“payment_method”]=> string(0) “”

    [“payment_method_title”]=> string(0) “”

    [“transaction_id”]=> string(0) “”

    [“customer_ip_address”]=> string(0) “”

    [“customer_user_agent”]=> string(0) “”

    [“created_via”]=> string(0) “”

    [“customer_note”]=> string(0) “”

    [“date_completed”]=> NULL

    [“date_paid”]=> NULL

    [“cart_hash”]=> string(0) “”

    }

     

    [“data_store”:protected]=> object(WC_Data_Store)#31829 (4) {

    [“instance”:”WC_Data_Store”:private]=> object(WC_Order_Data_Store_CPT)#31832 (3) {

    [“internal_meta_keys”:protected]=> array(50) {

    [0]=> string(14) “_customer_user”

    [1]=> string(10) “_order_key”

    [2]=> string(15) “_order_currency”

    [3]=> string(19) “_billing_first_name”

    [4]=> string(18) “_billing_last_name”

    [5]=> string(16) “_billing_company”

    [6]=> string(18) “_billing_address_1”

    [7]=> string(18) “_billing_address_2”

    [8]=> string(13) “_billing_city”

    [9]=> string(14) “_billing_state”

    [10]=> string(17) “_billing_postcode”

    [11]=> string(16) “_billing_country”

    [12]=> string(14) “_billing_email”

    [13]=> string(14) “_billing_phone”

    [14]=> string(20) “_shipping_first_name”

    [15]=> string(19) “_shipping_last_name”

    [16]=> string(17) “_shipping_company”

    [17]=> string(19) “_shipping_address_1”

    [18]=> string(19) “_shipping_address_2”

    [19]=> string(14) “_shipping_city”

    [20]=> string(15) “_shipping_state”

    [21]=> string(18) “_shipping_postcode”

    [22]=> string(17) “_shipping_country”

    [23]=> string(15) “_completed_date”

    [24]=> string(10) “_paid_date”

    [25]=> string(10) “_edit_lock”

    [26]=> string(10) “_edit_last”

    [27]=> string(14) “_cart_discount”

    [28]=> string(18) “_cart_discount_tax”

    [29]=> string(15) “_order_shipping”

    [30]=> string(19) “_order_shipping_tax”

    [31]=> string(10) “_order_tax”

    [32]=> string(12) “_order_total”

    [33]=> string(15) “_payment_method”

    [34]=> string(21) “_payment_method_title”

    [35]=> string(15) “_transaction_id”

    [36]=> string(20) “_customer_ip_address”

    [37]=> string(20) “_customer_user_agent”

    [38]=> string(12) “_created_via”

    [39]=> string(14) “_order_version”

    [40]=> string(19) “_prices_include_tax”

    [41]=> string(15) “_date_completed”

    [42]=> string(10) “_date_paid”

    [43]=> string(15) “_payment_tokens”

    [44]=> string(22) “_billing_address_index”

    [45]=> string(23) “_shipping_address_index”

    [46]=> string(15) “_recorded_sales”

    [47]=> string(29) “_recorded_coupon_usage_counts”

    [48]=> string(29) “_download_permissions_granted”

    [49]=> string(20) “_order_stock_reduced”

    }

     

    [“meta_type”:protected]=> string(4) “post”

    [“object_id_field_for_meta”:protected]=> string(0) “”

    }

     

    [“stores”:”WC_Data_Store”:private]=> array(20) {

    [“coupon”]=> string(24) “WC_Coupon_Data_Store_CPT”

    [“customer”]=> string(22) “WC_Customer_Data_Store”

    [“customer-download”]=> string(31) “WC_Customer_Download_Data_Store”

    [“customer-download-log”]=> string(35) “WC_Customer_Download_Log_Data_Store”

    [“customer-session”]=> string(30) “WC_Customer_Data_Store_Session”

    [“order”]=> string(23) “WC_Order_Data_Store_CPT”

    [“order-refund”]=> string(30) “WC_Order_Refund_Data_Store_CPT”

    [“order-item”]=> string(24) “WC_Order_Item_Data_Store”

    [“order-item-coupon”]=> string(31) “WC_Order_Item_Coupon_Data_Store”

    [“order-item-fee”]=> string(28) “WC_Order_Item_Fee_Data_Store”

    [“order-item-product”]=> string(32) “WC_Order_Item_Product_Data_Store”

    [“order-item-shipping”]=> string(33) “WC_Order_Item_Shipping_Data_Store”

    [“order-item-tax”]=> string(28) “WC_Order_Item_Tax_Data_Store”

    [“payment-token”]=> string(27) “WC_Payment_Token_Data_Store”

    [“product”]=> string(25) “WC_Product_Data_Store_CPT”

    [“product-grouped”]=> string(33) “WC_Product_Grouped_Data_Store_CPT”

    [“product-variable”]=> string(34) “WC_Product_Variable_Data_Store_CPT”

    [“product-variation”]=> string(35) “WC_Product_Variation_Data_Store_CPT”

    [“shipping-zone”]=> string(27) “WC_Shipping_Zone_Data_Store”

    [“webhook”]=> string(21) “WC_Webhook_Data_Store”

    }

     

    [“current_class_name”:”WC_Data_Store”:private]=> string(23) “WC_Order_Data_Store_CPT”

    [“object_type”:”WC_Data_Store”:private]=> string(5) “order”

    }

     

    [“meta_data”:protected]=> array(4) {

    [0]=> object(WC_Meta_Data)#31590 (2) {

    [“current_data”:protected]=> array(3) {

    [“id”]=> int(32684) [“key”]=> string(26) “_billing_reference_affaire”

    [“value”]=> string(6) “azerty” }

    [“data”:protected]=> array(3) {

    [“id”]=> int(32684)

    [“key”]=> string(26) “_billing_reference_affaire”

    [“value”]=> string(6) “azerty”

    }

    }

     

    [1]=> object(WC_Meta_Data)#31966 (2) {

    [“current_data”:protected]=> array(3) {

    [“id”]=> int(32685)

    [“key”]=> string(8) “_wpgdprc”

    [“value”]=> string(10) “1540977882”

    }

     

    [“data”:protected]=> array(3) {

    [“id”]=> int(32685)

    [“key”]=> string(8) “_wpgdprc”

    [“value”]=> string(10) “1540977882”

    }

    }

     

    [2]=> object(WC_Meta_Data)#31589 (2) {

    [“current_data”:protected]=> array(3) {

    [“id”]=> int(32686)

    [“key”]=> string(25) “billing_reference_affaire”

    [“value”]=> string(6) “azerty”

    }

     

    [“data”:protected]=> array(3) {

    [“id”]=> int(32686)

    [“key”]=> string(25) “billing_reference_affaire”

    [“value”]=> string(6) “azerty”

    }

    }

     

    [3]=> object(WC_Meta_Data)#31587 (2) {

    [“current_data”:protected]=> array(3) {

    [“id”]=> int(32690)

    [“key”]=> string(16) “woo_discount_log”

    [“value”]=> string(97) “{“price_discount”:”{“line_discount”:{“0da474fc8e382f9c6d6d774bb433339a”:[]}}”,”cart_discount”:[]}”

    }

     

    [“data”:protected]=> array(3) {

    [“id”]=> int(32690)

    [“key”]=> string(16) “woo_discount_log”

    [“value”]=> string(97) “{“price_discount”:”{“line_discount”:{“0da474fc8e382f9c6d6d774bb433339a”:[]}}”,”cart_discount”:[]}”

    }

    }

    }

    }

    #75062

    Mathieu
    Modérateur

    essayez avec ce code

    $order->get_meta("_billing_reference_affaire")

    Développeur PHP et WordPress En Alsace dans l'annuaire des prestataires WordPress et WooCommerce
    Création d'extensions pour WordPress et WooCommerce - Personnalisation d'extensions existantes
    🔶 Si vous appréciez mon aide, vous pouvez me faire un don de n'importe quel montant en cliquant ici.

4 sujets de 1 à 4 (sur un total de 4)

Vous devez être connecté pour répondre à ce sujet.