• Resolved annix

    (@annix)


    I would like to rename the checkout fields
    Street address
    Postcode/ZIP

    Can somebody direct me the PHP to edit?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Bibhu Prakash Ota

    (@bibhu1995)

    Hello,

    Do you want to customize the core plugin?
    You can also use the loco translator plugin to rename the text as per your requirement.

    Regards,
    Bibhu

    Thread Starter annix

    (@annix)

    customize the core plugin YES, direct me how

    Plugin Contributor Bibhu Prakash Ota

    (@bibhu1995)

    Hello,

    As per your requirement here is the source code details and you can modify as per your requirement.

    code file location : restropress\includes\rp-core-functions.php

    /**
     * Get defalut checkout fields
     *
     * @since 2.8
     * @return array
     */
    function rp_get_checkout_fields() {
    
      $customer  = RPRESS()->session->get( 'customer' );
      $customer  = wp_parse_args( $customer, array( 'delivery_address' => array(
        'address'   => '',
        'flat'      => '',
        'city'      => '',
        'postcode'  => '',
      ) ) );
    
      $customer['delivery_address'] = array_map( 'sanitize_text_field', $customer['delivery_address'] );
    
      if( is_user_logged_in() ) {
    
        $user_address = get_user_meta( get_current_user_id(), '_rpress_user_delivery_address', true );
    
        foreach( $customer['delivery_address'] as $key => $field ) {
    
          if ( empty( $field ) && ! empty( $user_address[ $key ] ) ) {
            $customer['delivery_address'][ $key ] = $user_address[ $key ];
          } else {
            $customer['delivery_address'][ $key ] = '';
          }
        }
      }
    
      $customer['delivery_address'] = apply_filters( 'rpress_customer_delivery_address', $customer['delivery_address'] );
    
      $checkout_fields = array(
        'rpress_street_address' => array(
          'id' => 'rpress-street-address',
          'title' => __( 'Street Address', 'restropress' ),
          'is_required' => true,
          'is_hidden' => false,
          'name' => 'rpress_street_address',
          'placeholder' => __( 'Street Address', 'restropress' ),
          'value' => $customer['delivery_address']['address'],
        ),
        'rpress_apt_suite' => array(
          'id' => 'rpress-apt-suite',
          'title' => __( 'Apartment, suite, unit etc. (optional)', 'restropress' ),
          'is_required' => false,
          'is_hidden' => false,
          'name' => 'rpress_apt_suite',
          'placeholder' => __( 'Apartment, suite, unit etc. (optional)', 'restropress' ),
          'value' => $customer['delivery_address']['flat'],
        ),
        'rpress_city' => array(
          'id' => 'rpress_city',
          'title' => __( 'Town / City', 'restropress' ),
          'is_required' => true,
          'is_hidden' => false,
          'name' => 'rpress_city',
          'placeholder' => __( 'Town / City', 'restropress' ),
          'value' => $customer['delivery_address']['city'],
        ),
        'rpress_postcode' => array(
          'id' => 'rpress-postcode',
          'title' => __( 'Postcode / ZIP', 'restropress' ),
          'is_required' => true,
          'is_hidden' => false,
          'name' => 'rpress_postcode',
          'placeholder' => __( 'Postcode / ZIP', 'restropress' ),
          'value' => $customer['delivery_address']['postcode'],
        ),
      );
    
      return apply_filters( 'rpress_checkout_fields', $checkout_fields, $customer['delivery_address'] );
    }

    Regards,
    Bibhu

    Thread Starter annix

    (@annix)

    Thank you very much, that worked
    Problem solved:)

    Kind regards
    Annix

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

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