开发者 |
fouadvollmer
grandy |
---|---|
更新时间 | 2019年7月30日 18:03 |
PHP版本: | 3.0 及以上 |
WordPress版本: | 5.2 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
Yes. You can change this under Woocommerce > Settings > General > WC Gift Packaging in the 'Gift packaging cost' field.
Yes. You can change the hook of the checkbox like this: ` add_filter( 'wc_gift_packaging_field_hook', 'custom_hook_position' ); function custom_hook_position( $text ) { return 'woocommerce_after_order_notes'; } `
Yes. You can change the text of the checkbox with the wc_gift_packaging_checkout_field
filter:
`
add_filter( 'wc_gift_packaging_checkout_field', 'my_checkbox_text' );
function my_checkbox_text( $text ) {
return __( "Send this order as awesome packaged gift" );
}
`
Yes. You can use the before_wc_gift_packaging_checkout_field
and after_wc_gift_packaging_checkout_field
hooks like this:
`
add_action( 'before_wc_gift_packaging_checkout_field', 'custom_start' );
function custom_start() {
echo '
';
}
add_action( 'after_wc_gift_packaging_checkout_field', 'custom_end' );
function custom_end() {
echo '';
}
`
Yes. You can use the wc_gift_packaging_admin_note
, wc_gift_packaging_order_note
or wc_gift_packaging_email_note
filters to completely change the note. Here are two examples:
`
add_filter( 'wc_gift_packaging_admin_note', 'custom_note', 10, 2 );
function custom_note( $text, $is_gift ) {
if( $is_gift ):
return '
' . __( "This is a regular order" ) . '';
else:
return '
' . __( "This order is a gift" ) . '';
endif;
}
add_filter( 'wc_gift_packaging_order_note', 'html_wrap', 10, 2 );
function html_wrap( $text, $is_gift ) {
return '
' . $text . '';
}
`
$order->id
to $order->get_order_number()
$checkout
parameter in the wc_gift_packaging_field
function optional to allows the usage of more hooks