Title: Email&#8217;s contain
Last modified: January 28, 2020

---

# Email’s contain

 *  Resolved [kamilen12](https://wordpress.org/support/users/kamilen12/)
 * (@kamilen12)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/emails-contain/)
 * Hello,
    How to change what mail (for example woocommerce order confirmation) 
   contains? I would like to add some extra informations in mail: ordinal number
   of product, cost per one piece, quantity of ordered product and whole value of
   ordered product (cost per one piece * quantity). Thank you for help!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Contributor [Ben Ritner – Kadence WP](https://wordpress.org/support/users/britner/)
 * (@britner)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/emails-contain/#post-12374735)
 * Hey,
    You would have to create custom placeholders for store/order-specific information
   like that.
 * For example, adding a placeholder for billing email could look like this in a
   snippets plugin:
 *     ```
       add_filter( 'kadence_woomail_order_body_text', 'custom_function_for_billing_email', 10, 2 );
       function custom_function_for_billing_email( $text, $order ) {
       if ( is_a( $order, 'WC_Order' ) ) {
       $text = str_replace( '{billing_email}',  $order->get_billing_email(), $text );
       }
       return $text;
       }
       ```
   
 * You would just need to create your own placeholders and the code to pull in that
   information from the order object.
 * Ben
 *  Thread Starter [kamilen12](https://wordpress.org/support/users/kamilen12/)
 * (@kamilen12)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/emails-contain/#post-12374871)
 * Thank you very much! I’ve resolved my problem, but I have another one. I think
   it’s easier but I don’t know much php. I would be grateful if you could help 
   me. It’s not related with the plugin, but I think for you it’s very easy. I have
   this code:
 *     ```
       // Add min value to the quantity field (default = 1)
       add_filter('woocommerce_quantity_input_min', 'min_decimal');
       function min_decimal($val) {
           return 0.1;
       }
   
       // Add step value to the quantity field (default = 1)
       add_filter('woocommerce_quantity_input_step', 'nsk_allow_decimal');
       function nsk_allow_decimal($val) {
           return 0.01;
       }
   
       // Removes the WooCommerce filter, that is validating the quantity to be an int
       remove_filter('woocommerce_stock_amount', 'intval');
   
       // Add a filter, that validates the quantity to be a float
       add_filter('woocommerce_stock_amount', 'floatval');
   
       // Add unit price fix when showing the unit price on processed orders
       add_filter('woocommerce_order_amount_item_total', 'unit_price_fix', 10, 5);
       function unit_price_fix($price, $order, $item, $inc_tax = false, $round = true) {
           $qty = (!empty($item['qty']) && $item['qty'] != 0) ? $item['qty'] : 1;
           if($inc_tax) {
               $price = ($item['line_total'] + $item['line_tax']) / $qty;
           } else {
               $price = $item['line_total'] / $qty;
           }
           $price = $round ? round( $price, 2 ) : $price;
           return $price;
       }
       ```
   
 * And it’s working perfectly, but I would like to make this code work only for 
   variable products. I think it’s about change somewhere in ‘woocommerce_quantity_input_step’
   to include the “variable” somewhere, but I dont know where and if it’s correct.
   I’ve tried many combinations but they weren’t working correctly.
 * Thank you much in advance!
    -  This reply was modified 6 years, 3 months ago by [kamilen12](https://wordpress.org/support/users/kamilen12/).
 *  Plugin Contributor [Ben Ritner – Kadence WP](https://wordpress.org/support/users/britner/)
 * (@britner)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/emails-contain/#post-12383006)
 *     ```
       // Add min value to the quantity field (default = 1)
       add_filter('woocommerce_quantity_input_min', 'min_decimal', 10, 2 );
       function min_decimal($val, $product) {
           if ( $product->is_type( 'variable' ) ) {
               return 0.1;
           }
           $return $val;
       }
   
       // Add step value to the quantity field (default = 1)
       add_filter('woocommerce_quantity_input_step', 'nsk_allow_decimal', 10, 2 );
       function nsk_allow_decimal($val, $product) {
           if ( $product->is_type( 'variable' ) ) {
               return 0.01;
           }
           $return $val;
       }
       ```
   
 * I didn’t test that code, but essentially you need to pass the product object 
   into the filter function and check for ‘variable’.
 *  Thread Starter [kamilen12](https://wordpress.org/support/users/kamilen12/)
 * (@kamilen12)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/emails-contain/#post-12383228)
 * Thank you very much! Your code really help me. For others: All you have to do
   is correct two things. You have to delete the “$” before ending return:
 *     ```
       // Add min value to the quantity field (default = 1)
       add_filter('woocommerce_quantity_input_min', 'min_decimal', 10, 2 );
       function min_decimal($val, $product) {
           if ( $product->is_type( 'variable' ) ) {
               return 0.1;
           }
           <strong>$return</strong> $val;
       }
   
       // Add step value to the quantity field (default = 1)
       add_filter('woocommerce_quantity_input_step', 'nsk_allow_decimal', 10, 2 );
       function nsk_allow_decimal($val, $product) {
           if ( $product->is_type( 'variable' ) ) {
               return 0.01;
           }
           <strong>$return</strong> $val;
       }
       ```
   
 * (I have bolded them) And it works as it should.
    Thank you one more time!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Email’s contain’ is closed to new replies.

 * ![](https://ps.w.org/kadence-woocommerce-email-designer/assets/icon-256x256.png?
   rev=3115863)
 * [Kadence WooCommerce Email Designer](https://wordpress.org/plugins/kadence-woocommerce-email-designer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/kadence-woocommerce-email-designer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/kadence-woocommerce-email-designer/)
 * [Active Topics](https://wordpress.org/support/plugin/kadence-woocommerce-email-designer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/kadence-woocommerce-email-designer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/kadence-woocommerce-email-designer/reviews/)

## Tags

 * [email](https://wordpress.org/support/topic-tag/email/)
 * [number](https://wordpress.org/support/topic-tag/number/)

 * 4 replies
 * 2 participants
 * Last reply from: [kamilen12](https://wordpress.org/support/users/kamilen12/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/emails-contain/#post-12383228)
 * Status: resolved