最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Stop WooCommerce from updating useruser meta after checkout

programmeradmin0浏览0评论

Customers have billing/shipping addresses saved to their account and when they checkout they are presented with the billing/shipping address fields. If they update them in the checkout and confirm their order, this also updates their addresses on their account. I understand this is the expected behaviour but not what our site requires.

I want to still show the address fields on the checkout but don't want it to update their account once it is being processed, but I also need the addresses they enter during checkout to be attached to the order meta, so the addresses on the order/order meta match those that they entered during checkout.

Is this possible? I've tried looking for hooks or how to programatically approach this but all I can find is how to add additional meta fields to an order which is not what I want.

Customers have billing/shipping addresses saved to their account and when they checkout they are presented with the billing/shipping address fields. If they update them in the checkout and confirm their order, this also updates their addresses on their account. I understand this is the expected behaviour but not what our site requires.

I want to still show the address fields on the checkout but don't want it to update their account once it is being processed, but I also need the addresses they enter during checkout to be attached to the order meta, so the addresses on the order/order meta match those that they entered during checkout.

Is this possible? I've tried looking for hooks or how to programatically approach this but all I can find is how to add additional meta fields to an order which is not what I want.

Share Improve this question asked May 2, 2019 at 16:25 no.no. 1331 gold badge1 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 3

To avoid user registration data to be updated each time an order is placed use the following:

add_filter( 'woocommerce_checkout_update_customer_data', '__return_false' );

Code goes in function.php file of your active child theme (or active theme). Tested and works.

发布评论

评论列表(0)

  1. 暂无评论