• Resolved valousal

    (@valentinanamorphik)


    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)
  • Plugin Author Collins Agbonghama

    (@collizo4sky)

    Am afraid, we can’t do that. We do however provide a filter you can use to remove any field you don’t want displayed on the myaccount page.

    Thread Starter valousal

    (@valentinanamorphik)

    This filter ?

    $data = apply_filters('ppress_checkout_billing_fields', $billing_fields);
    Plugin Author Collins Agbonghama

    (@collizo4sky)

    Can’t you use that filter?

    Thread Starter valousal

    (@valentinanamorphik)

    This filter ‘ppress_checkout_billing_fields‘ is not executed on the “Billing address” page.

    Plugin Author Collins Agbonghama

    (@collizo4sky)

    Before

    // skip woocommerce core billing / shipping fields added to wordpress profile admin page.

    Add the below filter

    if (apply_filters('ppress_myaccount_billing_details_disable_' . $field_key, false)) continue;

    Then, you can use it to by returning true for any field you want to skip.

    This change will be available in the next plugin update.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Checkout fields’ is closed to new replies.