Mike Jolley on "[Plugin: WooCommerce] How to customize checkout field?"

ساخت وبلاگ

Please tell me how to solve my problem!!

I try to customize checkout field of shipping address, and found following document.

https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

As the instruction says, I added two functions to my function.php under my child theme.
First one is for override a placeholder (If I put this, the webpage gets blank...), and second one is to add a field.

I updated woo commerce to 2.6.0 recently. Is that because it doesn't work? Or my code is something wrong?

// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) { $fields['shipping']['shipping_address_1']['placeholder'] = 'test'; retu $fields;
}
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) { $fields['shipping']['shipping_hotel'] = array( 'label' => __('Hotel', 'woocommerce'), 'placeholder' => _x('Hotel name', 'placeholder', 'woocommerce'), 'required' => false, 'class' => array('form-row-wide'), 'clear' => true ); retu $fields;
}

[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum's parser.]

https://wordpress.org/plugins/woocommerce/

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 216 تاريخ : جمعه 28 خرداد 1395 ساعت: 5:14