How to Customize Sample Product Order Variables: PRODUCT_TYPE and SAMPLE_PRICE
When a customer orders sample products from your store, the PRODUCT_TYPE
and SAMPLE_PRICE
custom order variables are added to identify and distinguish sample products from regular ones. These variables are displayed on various sections such as the order edit screen, order emails, and the "My Account" page.

This guide explains how to:
- Modify the text of these custom variables (e.g., changing
PRODUCT_TYPE
to "Product Type"). - Hide these variables entirely from the order details, if needed.
1. Modify the Text of Sample Order Variables
To change the text of the PRODUCT_TYPE
and SAMPLE_PRICE
variables, add the following code to your theme’s functions.php
file:
// Update sample order meta keys if ( ! function_exists( 'dsfps_update_sample_order_item_meta' ) ) { function dsfps_update_sample_order_item_meta( $display_key, $meta ) { // Modify the display text of sample product meta keys if ( $meta->key === 'PRODUCT_TYPE' ) { return 'Product Type'; // Change 'Product Type' as needed } elseif( $meta->key === 'SAMPLE_PRICE' ) { return 'Sample Price'; // Change 'Sample Price' as needed } return $display_key; } add_filter( 'woocommerce_order_item_display_meta_key', 'dsfps_update_sample_order_item_meta', 10, 2 ); }
Feel free to adjust the text in the above code according to your requirements.
2. Completely Hide Sample Order Variables
If you prefer to hide the PRODUCT_TYPE
and SAMPLE_PRICE
variables from displaying in all locations, add the following code to your theme’s functions.php
file:
// Hide sample order meta keys if ( ! function_exists( 'dsfps_hide_samples_custom_order_item_meta' ) ) { function dsfps_hide_samples_custom_order_item_meta( $formatted_meta, $item ) { if ( ! empty( $formatted_meta ) && is_array( $formatted_meta ) ) { foreach ( $formatted_meta as $key => $value ) { if ( isset( $value->key ) && ( $value->key === 'PRODUCT_TYPE' || $value->key === 'SAMPLE_PRICE' ) ) { unset( $formatted_meta[ $key ] ); // Remove the meta item } } } return $formatted_meta; } add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'dsfps_hide_samples_custom_order_item_meta', 10, 2 ); }
This code will completely hide the custom sample product variables from all areas of the store.
Important Note:
Both PRODUCT_TYPE
and SAMPLE_PRICE
are essential for distinguishing sample products from regular ones. While it is possible to hide them, we recommend against removing these variables entirely, as they serve a vital role in identifying sample products.