Skip to content

Custom internal key for saving custom payment form meta field #836

@aayla-secura

Description

@aayla-secura

Is your feature request related to a problem? Please describe.
I'd like to have a reliable way to programmatically get custom payment form fields for an invoice.

Currently I believe you can only get the custom payment form fields from the payment_form_data meta field saved for a given invoice, but it saves an associative array where the keys are the actual human-readable label of the field. This label could change and that would break code that is reading those fields.

Describe the solution you'd like
I would like to be able to specify a "key" that the data for this field will be saved as instead of using the label that's shown to the user. For example when I create a custom text field with a label "Any special dietary requirements?" I want to be able to set its internal array key to say "dietary" so that I can reliably do this, regardless if I decide to update the label shown to the user later:

$data = get_post_meta($invoice_id, 'payment_form_data');
$requirements = $data['dietary']; // instead of $data['Any special dietary requirements?']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions