Checkout fields
-
Hi,
On the “billing address” form on the “my account” page.
Is it possible to consider options?
For example, field labels are not retrieved as on the Stripe form.My suggestions is :
- replace ‘$billing_details_fields = CheckoutFields::standard_billing_fields();‘ by ‘$billing_fields = array_keys(CheckoutFields::billing_fields());‘ in the “billing-details.tmpl.php” template
## billing-details.tmpl.php // $billing_details_fields = CheckoutFields::standard_billing_fields(); $billing_fields = array_keys(CheckoutFields::billing_fields());'- use this function in the “billing-details.tmpl.php” template :
$billing_fields = self::standard_billing_fields(); $collection = ppress_var(get_option(self::DB_OPTION_NAME, []), 'billing', []); if ( ! empty($collection)) { array_walk($collection, function (&$v, $k) use ($billing_fields) { $v['label'] = wp_kses_post($v['label'] ?? ($billing_fields[$k]['label'] ?? '')); $v['width'] = sanitize_text_field($v['width'] ?? ($billing_fields[$k]['width'] ?? 'full')); $v['required'] = sanitize_text_field($v['required'] ?? ($billing_fields[$k]['required'] ?? 'false')); $v['logged_in_hide'] = sanitize_text_field($v['logged_in_hide'] ?? ($billing_fields[$k]['logged_in_hide'] ?? 'true')); $v['field_type'] = $billing_fields[$k]['field_type'] ?? 'text'; $v['deletable'] = $billing_fields[$k]['deletable'] ?? 'true'; }); $billing_fields = $collection; }Thanks.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Checkout fields’ is closed to new replies.