admin管理员组

文章数量:1129424

I've added a new tab into my "My-account" page on woocommerce using a hybrid of the following:

New Tab: Woocommerce add new tab to account page

New Content to tab: Add content to tab

I've been successful with this and it is working great, the new tab is there and so is the relevant content.

The issue I have is that the "Save Changes" button doesn't appear at the bottom of the new tab. I think I could probably hack around at the PHP code (copy the source code for the button from abother tab) to get the button in place - but I want to learn the correct way to do this.

Could anyone please give me some pointers?

Thanks Chris

I've added a new tab into my "My-account" page on woocommerce using a hybrid of the following:

New Tab: Woocommerce add new tab to account page

New Content to tab: Add content to tab

I've been successful with this and it is working great, the new tab is there and so is the relevant content.

The issue I have is that the "Save Changes" button doesn't appear at the bottom of the new tab. I think I could probably hack around at the PHP code (copy the source code for the button from abother tab) to get the button in place - but I want to learn the correct way to do this.

Could anyone please give me some pointers?

Thanks Chris

Share Improve this question asked Apr 7, 2020 at 9:33 Walshie1987Walshie1987 1092 bronze badges 2
  • Hi, welcome to WordPress Development. As a rule, the community considers questions about third-party plugins (such as woocommerce) off-topic so you might notice some down-votes and answers may be slow if they come at all. You can find out what questions are a good fit here. – Matthew Brown aka Lord Matt Commented Apr 7, 2020 at 13:06
  • 1 Thanks Matt, appreciate the tip, I'll check out the link – Walshie1987 Commented Apr 7, 2020 at 13:39
Add a comment  | 

1 Answer 1

Reset to default 0

Basically, if you output your custom form fields on a custom My Account tab, it means you're outside of my account form territory - you should wrap the fields in their own custom form (tag), and you also need a form handler function.

You can see an example implementation here - and you can find a relevant StackOverflow topic with a more detailed explanation here (I used this SO answer to write the afore-mentioned gist).

本文标签: customizationWoocommerce custom quotMy Accountquot TabAdd Save button