自定义woocommerce产品名称挂钩

时间:2019-12-17 02:44:04

标签: wordpress woocommerce hook-woocommerce

这样做的原因是因为我当前已使用自定义函数设置了默认产品名称挂钩,并且我目前正在尝试设置另一个自定义挂钩,以避免与我的默认挂钩冲突。这就是我的自定义功能(钩子)所具有的功能。请随时对我创建的自定义函数提供建议。 (目前不工作)

代码如下:

handleSignUp = () => {
  firebase.auth()
      .createUserWithEmailAndPassword(this.state.email, this.state.password).then((user)=>{
        //console.log('uid',user.user.uid)
        this.setState({ uid: user.user.uid })
      }).then(() => {
        //insert new record into our realtime database
        return this.addUser(this.state.uid,this.state.email,1000); //users are given 1000 in rewards to start
      }).then(() => {
        this.props.navigation.navigate('Profile');
      }).catch(error => this.setState({ errorMessage: error.message }))
  }


  addUser = (id,email,rewards) => {
    return Firebase.database().ref('UsersList/').push({
      id,
      email,
      rewards
    });
  }

请随时询问我是否引起任何混乱。干杯。

1 个答案:

答案 0 :(得分:0)

上面是一个(WC版本2.5.2)可以让我知道您使用的是哪个版本的WC?

请尝试以下动作挂钩:

add_action('custome_product_name', 'show_product_name');
function show_product_name(){
    echo get_the_title( 'ID' );
}