I want to configure the subscription endpoint located in my account page of woocommerce?

◇◆丶佛笑我妖孽 提交于 2019-12-08 06:46:10

问题


What i want is to edit a subscription in my account page of woocommerce. i have shared a picture below, of what exactly I want to edit.

This is the link of picture, what i want to edit is highlighted with red pen:

I want to edit the things which are highlighted with red pen. but i am unable to locate the exact page of this where i can edit things. actually i want to change the link of update button in subscription table. the URL of the page is like :

https://www.example.com/my-account/subscriptions/ There is no subscription page in pages menu of wordpress.

I am also unable to see this in endpoint of woocommerce.

Is there any way to do it ?


回答1:


First have a look to that: Template structure & Overriding templates via a theme… It explains how to override correctly woocommerce templates via your active theme.

The templates that you will override have to be located in woocommerce folder inside your theme folder…

Now in the woocommerce-subscriptions plugin folder, you have also a template folder, and you can pick the necessary templates that you need to change, copying them into that woocommerce folder located in your theme, taking care to keep path (subfolder hierarchy)…

So you will copy from: wp-content/plugins/woocommerce-subscriptions/templates/myaccount(5 files inside)… to wp-content/themes/your-theme/woocommerce/myaccount (where your-theme is the folder name of your theme)…

Now you can edit templates just like the woocommerce ones…

The subscription end point is not listed in woocommerce as it's not a default end point

To rename the menu label for "Subscriptions", you can use this:

add_filter( 'woocommerce_account_menu_items', 'rename_my_account_menu_items', 0, 15 );
function rename_my_account_menu_items( $items ) {

    // HERE set your new label name for subscriptions
    $items['subscriptions'] = __( 'Custom label', 'woocommerce' );

    return $items;
}

The code goes on function.php file of your active child theme (or theme) or in any plugin file.

Tested and working



来源:https://stackoverflow.com/questions/47661356/i-want-to-configure-the-subscription-endpoint-located-in-my-account-page-of-wooc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!