相关疑难解决方法(0)

在订单商品视图中显示自定义产品数据

我有添加到购物车的问题.我有一个产品有不同的自定义条件可供选择.当客户选择特定选择时.它增加了购物车.当客户选择另一个选择并添加.它显示为购物车中的第二个项目.哪个没关系.但在付款后,订单会显示项目1和项目2下的自定义选项,而不显示自定义数据.

所以我在思考而不是展示与不同产品相同的产品.我想更新产品自定义数据,因此它将始终显示为单个项目.

(注意:我已经从管理员启用了"单独销售"选项,但其工作正常).

如果没有,你可以告诉我如何正确显示订单,所以付款后发送的电子邮件,订单页面将正确显示.

注意:我使用的自定义数据是loc和date.

先感谢您.

php wordpress custom-fields orders woocommerce

3
推荐指数
1
解决办法
1049
查看次数

将用户自定义字段值添加到订单项详细信息

与供应商(WC供应商)一起开发WooCommerce网上商店.

我需要显示我在供应商资料中创建的自定义字段.它应显示在项目和供应商名称下order-details.php.

如何按卖家/供应商ID显示个人资料字段?
有人可以帮帮我吗?

这是我将要撒谎的屏幕截图:

订单详细信息

配置自定义字段

向用户个人资料页面添加自定义字段

add_action( 'show_user_profile', 'wp_added_user_profile_fields' );

function wp_added_user_profile_fields( $user ) {

    ?>

    <table class="form-table">

        <tr>

            <th><label for="billing_enumber"><?php _e( "eNumber", 'woocommerce' ); ?></label></th>

            <td>
                <input type="text" 
                       name="billing_enumber" 
                       id="billing_enumber" 
                       class="regular-text"
                       value="<?php echo esc_attr( get_the_author_meta( 'billing_enumber', $user->ID ) ); ?>"/>

                <span class="description"><?php _e( 'Please enter your eNumber.', 'woocommerce' ); ?></span>
            </td>

        </tr>

    </table>

    <?php
}
Run Code Online (Sandbox Code Playgroud)

将更新功能添加到用户配置文件的自定义字段

add_action( 'edit_user_profile', 'wp_added_user_profile_fields' );

    function wp_save_added_user_profile_fields( $user_id ) {

        if ( current_user_can( 'edit_user', $user_id ) ) {

            update_user_meta( $user_id, 'billing_enumber', …
Run Code Online (Sandbox Code Playgroud)

php wordpress custom-fields orders woocommerce

3
推荐指数
1
解决办法
2943
查看次数

标签 统计

custom-fields ×2

orders ×2

php ×2

woocommerce ×2

wordpress ×2