How to programmatically edit the account page in woocommerce

You can do it. In the woocommerce directory, open the template file and browse the myaccount folder.
Open the plugins \/ woocommerce \/ templates \/ myaccount \/ myaccount folder to find all the template files used on the my account page. This is the default file currently running on your website. To overwrite the file, you must create a new file with the same name in the subtopic. However, if you create an empty file, all functions of the source file will be disabled. Therefore, in order to avoid problems with the site, you must copy the default file and paste it into the theme folder. For example, in the woocommerce installation, dashboard. Suppose you want to copy a PHP file. Before pasting into a subtopic, you must create two nested subdirectories and name them \/ woocommerce and \/ myaccount. Then, the dashboard. Paste PHP file: child_theme\/woocommerce\/myaccount\/dashboard. php
Now dashboard Make a few changes to open the PHP file and verify that it works properly. That’s all! Learned how to redefine the woocommerce template file. That’s the first step. Now let’s learn more about how to customize the my account page. Now that you know how to redefine the my account page dashboard custom template file, let’s take a look at how to programmatically edit the woocommerce my account page. This section describes how to customize the default dashboard on the my accounts page. When this process is complete, the my account page appears as follows:
The title picture and some text are added below it. In addition, in order to facilitate customer contact, we have also created a list containing links to parts that users visit more often, footnotes and some image links. The final dashboard that generates screenshots on the entire script. PHP file. If (! Defined (\
exit Direct access will exit.
}
$allowd_html = array(
‘a’ => array(‘href’ => array(),)
);
?>

‘ . esc_html( $current_user->display_name ) . ‘ ‘,
esc_url( wc_logout_url() )
);
?>

<?php
printf(
/* 번역기: 1: 사용자 표시 이름 2: 로그아웃 url */
wp_kses( __( '안녕하세요 %1$s, 돌아왔습니다! ', 'woocommerce' ), $allowed_html ),
'

Male recently ordered male view male
Male distribution and invoice receiving address male management
Male modify password and account details
‘);
$div_contact = __(‘

<?php
/* 번역자: 1: 주문 URL 2: 주소 URL 3: 계정 URL. */
$dashboard_desc = __( '계정의 메인 대시보드입니다: ', 'woocommerce' );
if ( wc_shipping_enabled() ) {
/* 번역자: 1: 주문 URL 2: 주소 URL 3: 계정 URL. */
$dashboard_desc = __( '계정의 메인 대시보드입니다:', 'woocommerce' );
}
printf(
wp_kses( $dashboard_desc,$allowed_html),
esc_url( wc_get_endpoint_url( '주문' ) ),
esc_url( wc_get_endpoint_url( '편집 주소' ) ),
esc_url( wc_get_endpoint_url( '편집 계정' ) )
);
$ul_list = __('

‘);
$div_footer=__(‘

Male build with love!

‘);
?>

Male manage personal data and personal information here. Fill out all the fields so that you can understand. All versions created in your account are immediately reflected on the website, so other users can immediately understand you and your current needs.

To display an image on the my account page where you add an image, you must replace the URL of the image. Social icon image links also apply. Another way to customize the my account page and other pages is to use CSS scripts. Here is the custom dashboard. CSS script to specify the PHP file style. woocommerce-MyAccount-content > h2:nth-child(2),
.woocommerce-MyAccount-content > h3:nth-child(4){
Text alignment: centered;
}
.acc_contact{
Top of down jacket: 20px;
Text alignment: centered;
}
.acc_contact > h3{
towards the left
}
.acc_images{
Blank: automatic;
Width: 50%;
Display: blocks;
}
#
welcome
Blank: automatic;
}
.acc_images img {
Margin – left: 4PX;
Blank right: 4PX;
Display: embedded block;
Width: 55 pixels;
}
#acc_footer{
Blank upper end: 15px;
Background color: #202020;
Text alignment: centered;
Border radius: 15px;
}
#acc_footer > h4{
Top of down jacket: 20px;
Color: rgb (235, 228, 228);
Font thickness: bold;
}
#acc_footer > img{
Blank: automatic;
Lower end of down jacket: 20px;
}This code is used as the style of the sub theme by default. You can paste it into a CSS file and customize it according to the look and feel of the site.
2. Edit the internal account page by hooking. The second method of programmatically editing the internal account page is to use woocommerce hooking. To do this, you need to have a basic understanding of how hooking works in woocommerce. If you are not familiar with hooking, it is recommended to check this guide. A) Rename label this script changes the name of the address label to your address. add_filter( ‘woocommerce_account_menu_items’, ‘QuadLayers_rename_acc_adress_tab’, 9999 );
Function quadlayers_rename_acc_adress_tab ($items){
$items [\
Return $items;
}
B) To remove a tab completely, use the unset() function:
add_filter( ‘woocommerce_account_menu_items’, ‘QuadLayers_remove_acc_address’, 9999 );
Function quadlayers_remove_acc_address ($items){
Disable ($items [\
Return $items;
}The tab has been removed from the above script$ In the items array, you can find a complete list of tab slashes, so you can choose anything$ Items = array(
\
\
\
\
\
\
\
);
C) Another option for the custom tab and accounts page in content merge is the merge tab. For example, we’ll learn how to remove the address tab and move the content to the Account tab\/\/—————————————————
\/\/ 1. Delete address tab
add_filter( ‘woocommerce_account_menu_items’, ‘QuadLayers_remove_acc_tab’, 999 );
Function quadlayers_remove_acc_tab ($items){
Unset ($items [\
Return $items;
}
\/\/ ——————————-
\/\/ 2. Insert the contents of the addresses tab into the existing tab (in this case, edit account)
add_action( ‘woocommerce_account_edit-account_endpoint’, ‘woocommerce_account_edit_address’ );
The accounts tab appears: D) add a new tag with custom content. Now let’s see how to add content to the my account page. In this example, we will add a new tab called \
The code you want to use must be displayed on the new Shortcut tab. However, some shortcut code may not work due to incompatibility with woocommerce. To add a support tab with customized content on the account page within woocommerce, see functions in the subtopic. Paste the following code into the PHP file\/\/ 1. Register a new endpoint
\/\/Note: if you do not save the permanent link again, a 404 error will appear.
Function quadlayers_add_support_endpoint (){
Add_rewrite_endpoint (\
}
Add_action (\
\/\/ ——————
\/\/ 2. Add new query
Features quadlayers_support_query_vars ($vars){
[$vars] = \
Return $vars;
}
add_filter( ‘query_vars’, ‘QuadLayers_support_query_vars’, 0 );
\/\/ ——————
\/\/ 3. Insert new endpoint
Function quadlayers_add_support_link_my_account ($items){
$items [\
Return $items;
}
add_filter( ‘woocommerce_account_menu_items’, ‘QuadLayers_add_support_link_my_account’ );
\/\/ ——————
\/\/ 4. Add content to new endpoint
Function quadlayers_support_content (){
Welcome to echo support. Advanced customers can manage support tickets here and submit tickets in case of problems on the website. We will do our best to provide fast and efficient solutions. ‘;
Echo_shortcode (\
echo do_shortcode( ‘[wpforms]’ );
}
add_action( ‘woocommerce_account_support_endpoint’, ‘QuadLayers_support_content’ );
If you cannot find the 404 page error when you click the new tab, navigate to WordPress dashboard > Settings > permanent links, open the permanent links page, and then click the Save button at the bottom. The script is divided into four parts. Each of them performs different tasks, so use the part to add to the store. Also, remember that in the last section of the script (4), you can change the shortcut code of the do_shortcode() function. This is the end result of the new support tab. Male conclusion in general, the basic internal account page has the basic information that users need, but it is very basic. Therefore, to improve the user experience of the store, you must customize the my account page. This not only helps to improve the very important part of the store, but also helps to improve sales. There are several plug-ins for customizing the my account page. However, if you don’t want to install plug-ins and have coding technology, you can edit the account page in woocomer programmatically. There are two options for this. Although both woocommerce hooking methods for redefining template files have completed the operation, it is generally recommended to use hooking when possible. This is one of the best practices recommended by WordPress and is less risky. This guide provides several examples where both methods can be used. It is recommended that you use this script as a guide to get ideas and maximize the use of my account pages in the store. Finally, in order to make the most of my account page

Author:

Leave a Reply

Your email address will not be published. Required fields are marked *