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

Adding Field in WooCommerce

programmeradmin3浏览0评论

I would like to add a field in WooCommerce checkout page. I would like to use below code.

add_filter( 'woocommerce_checkout_fields' , 'my_override_checkout_fields' );

But in which file should I put this code ?

I would like to add a field in WooCommerce checkout page. I would like to use below code.

add_filter( 'woocommerce_checkout_fields' , 'my_override_checkout_fields' );

But in which file should I put this code ?

Share Improve this question asked Apr 2, 2020 at 6:07 FoysalFoysal 4451 gold badge5 silver badges16 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The short, common answer is:

Inside functions.php file in your theme.

The more advanced answer is:

Well... In any file that is included and executed.

One way is to create your own plugin and put that line inside it.

Another way is to put it in functions.php file in your theme.

Remember, that you should never modify ready themes, so if you use one, you should create a child theme and put that code inside it.

And of course it doesn’t need to be exactly functions.php - you can create any file (like inc/woo-functions.php), put that code inside it and then include it in your functions.php file.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论