我要配置位于woocommerce帐户页面中的订阅终结点吗? [英] I want to configure the subscription endpoint located in my account page of woocommerce?

查看:106
本文介绍了我要配置位于woocommerce帐户页面中的订阅终结点吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要的是在woocommerce的帐户页面中编辑订阅。我在下面分享了我想要编辑的图片。



这是图片的链接,我要编辑的内容用红笔突出显示:





我要编辑用红笔突出显示的内容。但是我无法找到可以编辑内容的确切页面。
实际上我想更改订阅表中更新按钮的链接。
页面的网址类似于:





有什么办法吗?

解决方案

首先查看一下:模板结构&通过主题覆盖模板…它说明了如何通过活动主题正确覆盖woocommerce模板。



要覆盖的模板必须位于woocommerce中主题文件夹中的文件夹...



现在在woocommerce-subscriptions插件文件夹中,您还有一个模板文件夹,您可以选择需要更改的必要模板,将它们复制到您主题中的woocommerce文件夹中,注意保持路径(子文件夹层次结构)…



因此,您将从以下位置复制: wp- content / plugins / woocommerce-subscriptions / templates / myaccount (其中5个文件)…到 wp-content / themes / your-theme / woocommerce / myaccount (其中您的主题是您的主题的文件夹名称)…



现在您可以像woocommerce模板一样编辑模板…


在woocommerce中未列出订阅端点,因为它不是默认端点点


要重命名订阅的菜单标签,您可以使用以下方法:

  add_filter('woocommerce_account_menu_items','rename_my_account_menu_items',0,15); 
函数named_my_account_menu_items($ items){

//在此处为订阅设置新标签名
$ items ['subscriptions'] = __('Custom label','woocommerce ');

返回$项;
}

该代码位于活动子主题的function.php文件中(或主题)或任何插件文件中。



经过测试并可以正常工作


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 ?

解决方案

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

这篇关于我要配置位于woocommerce帐户页面中的订阅终结点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆