Woocommerce自定义结帐领域如何将它们放在一起?

时间:2016-06-09 02:39:19

标签: php wordpress woocommerce

大家好,我在退房时在woocommerce中制作自定义表单。我想让我的田地彼此相邻。我该如何做到这一点?这就是我现在所拥有的,它只是将它们放在彼此之下

add_action( 'woocommerce_before_checkout_billing_form', 'checkoutFields' );

function checkoutFields( $checkout ) {

    echo '<div id="my-custom-step"><h2>' . __('My Field') . '</h2>';

    woocommerce_form_field( 'orgin_firstname', array(
        'type'          => 'text',
        'class'         => array('orgin_firstname form-row-first'),
        'label'         => __('First Name'),
        'placeholder'   => __(''),
        'required'      => true,
        ), $checkout->get_value( 'orgin_firstname' ));

    woocommerce_form_field( 'orgin_lastname', array(
        'type'          => 'text',
        'class'         => array('orgin_lastname form-row-last'),
        'label'         => __('Fill in this field yo'),
        'placeholder'   => __('Enter something '),
        ), $checkout->get_value( 'orgin_lastname' ));

    echo '</div>';

}

我添加这些字段的方式也很重要。我现在正在这样做:

    jQuery(function(){
        jQuery(".orgin_firstname").detach().appendTo(".customSteps") //this is my div I am putting them in
})
    jQuery(function(){
        jQuery(".orgin_lastname").detach().appendTo(".orgin_firstname")
})

1 个答案:

答案 0 :(得分:0)

我意识到我的错误是在应该自定义步骤时追加到orgin_firstname。