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

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

问题描述

我想要的是在我的 woocommerce 帐户页面中编辑订阅.我在下面分享了一张图片,说明了我想要编辑的内容.

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

我想编辑用红笔突出显示的东西.但我无法找到我可以编辑内容的确切页面.实际上我想更改订阅表中更新按钮的链接.页面的 URL 是这样的:

有什么办法吗?

解决方案

首先看一下:模板结构&通过主题覆盖模板...它解释了如何通过您的活动主题正确覆盖 woocommerce 模板.

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

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

所以你将从:wp-content/plugins/woocommerce-subscriptions/templates/myaccount(里面有 5 个文件)...复制到 wp-content/themes/your-theme/woocommerce/myaccount(其中 your-theme 是你的主题的文件夹名称)...

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

<块引用>

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

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

add_filter( 'woocommerce_account_menu_items', 'rename_my_account_menu_items', 0, 15 );函数 rename_my_account_menu_items( $items ) {//这里为订阅设置新的标签名称$items['subscriptions'] = __('自定义标签', 'woocommerce');返回 $items;}

代码位于活动子主题(或主题)的 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天全站免登陆