Change “Billing Details” text to “Shipping Details” on WooCommerce checkout page

后端 未结 2 1039
广开言路
广开言路 2020-12-06 15:25

I currently have a bit of code in my child theme\'s functions.php file which is supposed to change \"Billing Details\" to say \"Shipping Details\" on my WooCommerce checkout

相关标签:
2条回答
  • 2020-12-06 16:00

    To override woocommerce views, you need to copy the required template files from woocommerce/templates to your theme directory. In this case copy woocommerce/templates/checkout/form_billing.php to your theme folder as woocommerce/checkout/form_billing.php and edit the following code around line 27.

    <?php if ( wc_ship_to_billing_address_only() && WC()->cart->needs_shipping() ) : ?>
    
        <h3><?php _e( 'Billing &amp; Shipping', 'woocommerce' ); ?></h3>
    
    <?php else : ?>
    
        <h3><?php _e( 'Billing details', 'woocommerce' ); ?></h3>
    
    <?php endif; ?>
    
    0 讨论(0)
  • 2020-12-06 16:01
    function wc_billing_field_strings( $translated_text, $text, $domain ) {
        switch ( $translated_text ) {
            case 'Billing details' :
                $translated_text = __( 'Billing Info', 'woocommerce' );
                break;
        }
        return $translated_text;
    }
    add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
    

    Tested OK with WooCommerce 3.0.6

    0 讨论(0)
提交回复
热议问题