Add custom fields to WooCommerce Order

Support General Add custom fields to WooCommerce Order

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #49635
    FrancescoFrancesco
    Participant

    Hi there!
    I am trying to add custom fields to WooCommerce Orders with MetaBox but it is not working: custom fields are displayng for products but not for orders.
    Do you have any suggestion?

    #49642
    PeterPeter
    Moderator

    Hello,

    Please use the option WordPress posts storage (legacy) for order on the settings page WooCommerce > Settings > Advanced > Features, instead of HPOS (High-performance order storage) and recheck the issue.

    Let me know how it goes.

    #49648
    FrancescoFrancesco
    Participant

    Ok, now custom fields are showing correctly, thank you!
    Do you think it would be possible to complete this order custom fields during the WooCommerce checkout process?

    #49655
    PeterPeter
    Moderator

    Hello,

    No, it isn't possible. Meta Box will create input fields in the admin area, the user can fill the fields with values and output values in the frontend. We don't support adding field value on the Cart or Checkout page in the frontend.

    Thanks.

    #49657
    FrancescoFrancesco
    Participant

    Ok, thanks.
    And what about editing custom fields linked to each order in the single order detail page located in the woocommerce account page?
    It would be possibile through the metabox frontend submission extension?

    #49717
    FrancescoFrancesco
    Participant

    Hi there! Could you please help me with this?

    #49723
    PeterPeter
    Moderator

    Hello,

    Yes, it is possible. If you can pass the order ID to the attribute object_id of the frontend form shortcode, you can edit the custom field of the order in the frontend on any page. Here is an example:

    [mb_frontend_form id='order-custom-fields' post_type="shop_order" object_id="1234"]

    Please read more about attributes in the documentation https://docs.metabox.io/extensions/mb-frontend-submission/

    #49756
    zenjukai@gmail.com[email protected]
    Participant

    "Do you think it would be possible to complete this order custom fields during the WooCommerce checkout process?"

    I know this is an older post, but it depends on what you are wanting to send to the cart and checkout, but yes you can with a bit of custom code.

    Cheers

    #49758
    FrancescoFrancesco
    Participant

    Thanks a lot Peter, I have done it!
    A few more questions:
    - is there a way to let Woo Clients only edit the existing fields and not adding more clonable fields to the group?
    - is there a way to add custom classes to forntend submission form buttons?
    - is there a way to customize the Submit button?

    Thanks a lot.
    Best regards.

    #49764
    PeterPeter
    Moderator

    Hello Francesco,

    1. No, there isn't an option to edit the existing field only without adding more cloneable fields.

    2, 3. You can use the filter hook rwmb_frontend_submit_button to customize the submit button. Please follow the documentation https://docs.metabox.io/extensions/mb-frontend-submission/#form-hooks

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.