开发者 | freshlythemes |
---|---|
更新时间 | 2017年7月4日 21:24 |
PHP版本: | 4.0 及以上 |
WordPress版本: | 4.8 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
wp-content/plugins/
folder locallywp-admin/plugins.php
on your site (your WP Admin plugin page)For the initial release, order notes are non-conditional and the checkout field is displayed, but not required on all orders. However, If the free Download As Services plugin is installed and active, the field will only be displayed if an item within the cart is marked as a “service”. The field will be a requirement in this instance.
You can add the following action to your child theme functions.php file to make the field a requirement on all orders:
add_filter( 'edd_purchase_form_required_fields', 'edd_order_notes_purchase_form_required_fields' );
You can add the following action to your child theme functions.php to impose a 140 maximum character limit on the entered order notes:
add_action( 'edd_checkout_error_checks', 'edd_order_notes_validate_checkout_fields', 10, 2 );
If you wish further control, you can use a function similar to the following within your child theme functions.php file:
function ft_edd_order_notes_validate_checkout_fields( $valid_data, $data ) { if ( strlen( $data['edd_order_notes'] ) > 140 ) { edd_set_error( 'invalid_order_notes', 'Order notes must be 140 characters or less.' ); } } add_action( 'edd_checkout_error_checks', 'ft_edd_order_notes_validate_checkout_fields', 10, 2 );
Note: Replace the 140 value with whatever character limit you wish to impose. Similarly, you can switch the > operator to < to impose a minimum character limit (be sure to update the error message wording to reflect this change).
By default the order notes are displayed on a separate section within the customer payment receipt to accommodate larger paragraphs while maintaining line breaks. If you do, however, wish to output the notes as part of the payment receipt table, you can use the following code to do so within your child theme functions.php file: `remove_action( 'edd_payment_receipt_after_table', 'edd_order_notes_payment_receipt_after_table' ); remove_action( 'fes_payment_receipt_after_table', 'edd_order_notes_payment_receipt_after_table' ); add_action( 'edd_payment_receipt_after', 'edd_order_notes_payment_receipt_after' ); add_action( 'fes_payment_receipt_after', 'edd_order_notes_payment_receipt_after' );`
Order Notes includes the UK English language files. We have, however, included a POT file to get you started translating into the language of your choice! We always welcome language translation submissions, so if you translate one of our plugins into your native language, please send us the translation file for inclusion in a future release. We credit all submissions.