How to display custom field in woocommerce email orders? [closed]

If the code you have provided is the only code you are using to achieve what you want then thats incomplete code. Below is the tested version of code which works well. I hope this helps: /* Add the field to the checkout */ add_action(‘woocommerce_after_order_notes’, ‘my_custom_checkout_field’); function my_custom_checkout_field( $checkout ) { echo ‘<div id=”my_custom_checkout_field”><h3>’.__(‘My Field’).'</h3>’; … Read more

Woocomemrce order and registration fileds to UPPERCASE

First add the following code (and probably the WC Test Payment Gateway) and do a test order to get a list of all the data keys that are set in the order process via the woocommerce_after_checkout_validation filter: add_action(‘woocommerce_after_checkout_validation’,’custom_modify_order’,10,1); function custom_modify_order($posted) { foreach ($posted as $key => $value) {$data .= $key.”:”.$value.PHP_EOL;} $fh = fopen(get_stylesheet_directory().’/orderdebug.txt’,’w’); fwrite($fh,$data); fclose($fh); … Read more

How to set a default value in a meta box

Here’s a tweaked version of the referenced wpse103469_add_price_per_unit_meta_to_price() function. If no units have been specified, the default units are appended to the price, otherwise the user-specified units are used. add_filter(‘woocommerce_get_price_html’, ‘wpse103469_add_price_per_unit_meta_to_price’); function wpse103469_add_price_per_unit_meta_to_price( $price ) { $default_units = __( ‘sq. ft.’, ‘myplugin_textdomain’ ); $units = get_post_meta( get_the_ID(), ‘wc_price_per_unit_key’, true ); return ( $units ) ? … Read more

WooCommerce: remove sample & dummy data

Even though it’s dummy data, there is nothing special about it compared to actual data other than the fact that it’s all made up for testing purposes. I assume that you only imported dummy data for testing and not actual data. If so, I’d recommend that you manually delete the dummy data through WordPress.

Changing a text label into an image

Changing the label text (text only) The text “Member discount!” can be changed using a translation filter, but it’s not possible to add an image or any HTML to that because it is escaped later in the code referenced in the question: $badge=”<span class=”onsale wc-memberships-member-discount”>” . esc_html( $label ) . ‘</span>’; Here is an example … Read more