Display custom field in account page

Support MB User Meta Display custom field in account pageResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37978
    Marius DokoMarius Doko
    Participant

    Hello,

    I have been trying to display a custom field for Woocommerce Users but so far no luck :/. I don't understand where I am doing the mistake. Please could you have a look at my code?

    Thanks guys!

    <?php
    add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
    
    function your_prefix_function_name( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'   => __( 'Premium Membership', 'your-text-domain' ),
            'id'      => 'premium-membership',
            'type'    => 'user',
            'include' => [
                'relation'         => 'OR',
                'user_role'        => ['administrator'],
                'edited_user_role' => ['customer'],
            ],
            'fields'  => [
                [
                    'name'          => __( 'Expired Date', 'your-text-domain' ),
                    'id'            => $prefix . 'expired_date',
                    'type'          => 'text',
                    'admin_columns' => [
                        'position' => 'after name',
                        'sort'     => true,
                    ],
                    'columns'       => 6,
                ],
            ],
        ];
    
        return $meta_boxes;
    }
    #37990
    Long NguyenLong Nguyen
    Moderator

    Hi Marius,

    The code helps you to create the custom fields on the Profile page in the admin area. It does not help to create the custom fields on the My Account page of WooCommerce in the frontend. If you want to create some custom fields on the My Account page, please contact WooCommerce support for further assistance.

    #37994
    Marius DokoMarius Doko
    Participant

    Hello Long,

    Thank you, actually, i achieved this with metabox, you can mark this topic as resolved

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