Moderator
t-p
(@t-p)
I recommend asking at https://wordpress.org/support/plugin/woocommerce so the plugin’s developers and support community can help you with this.
Hi span40,
WooCommerce is made up of many different files and actions/filters to achieve the outcome on the front end.
The checkout templates can be found under woocommerce -> templates -> checkout
Depending on the sections you require to change / translate you may be able to hook in to some of the preset hooks or override the files in your theme via – https://docs.woocommerce.com/document/template-structure/
More on hooks and filters can be found at https://codex.wordpress.org/Plugin_API and WooCommerce have their own documentation.
Hope this helps
Thread Starter
span4o
(@span4o)
https://hirejordansmith.com/how-to-change-the-woocommerce-checkout-page-billing-and-address-forms/
// WooCommerce Checkout Fields Hook
add_filter( ‘woocommerce_checkout_fields’ , ‘hjs_wc_checkout_fields’ );
function hjs_wc_checkout_fields( $fields ) {
$fields[‘billing’][‘billing_first_name’][‘label’] = ‘Vārds’;
return $fields;
}
Found this guide, but am I doing something wrong?
Hey @span4o,
Please try changing the single marks to the ‘ equivalent. Currently they are being applied as ‘
// WooCommerce Checkout Fields Hook
add_filter( 'woocommerce_checkout_fields' , 'hjs_wc_checkout_fields' );
function hjs_wc_checkout_fields( $fields ) {
$fields['billing']['billing_first_name']['label'] = 'Vārds';
return $fields;
}
Works correctly for me once this has been changed. This sometimes happens when you copy code from websites.
This should be inserted in to your functions.php. Just make sure there isn’t any namespacing as well if your using a theme such as roots sage.
Also checkout – https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ for the WooCommerce documentation on this matter.
Many thanks
-
This reply was modified 6 years, 10 months ago by Adam Morgan.
-
This reply was modified 6 years, 10 months ago by Adam Morgan.
Thread Starter
span4o
(@span4o)
@adam3128 Hey man, thanks for reply.
Filters are working, but I also decided to use grep to search for the string I need.
A plugin would probably be a better solution.