What can we help you with?
Modifying product title and price in Stamps.com label (Code Snippet)
The below code snippet can be used to modify product title and price of each product in stamps label.
Kindly copy and paste the snippet in Appearance –> Editor –> functions.php.
add_filter('wf_stamps_request', 'wf_customize_stamps_products_title', 10, 2); function wf_customize_stamps_products_title( $request, $order ){ $new_product_titles = array( //Config this array with product name with corresponding values 'Mobile phone'=> array( 'Description' =>'Cell Phone', //new description. Leave this blank if no need to change. 'Value' => 500 //new price of the item. Leave this blank if no need to change. ), ); if( isset($request['Customs']['CustomsLines']['CustomsLine']) ){ foreach ($request['Customs']['CustomsLines']['CustomsLine'] as $key => $customs_items) { if( array_key_exists($customs_items['Description'], $new_product_titles ) ){ if( !empty( $new_product_titles[ $customs_items['Description'] ]['Value'] ) ){ $request['Customs']['CustomsLines']['CustomsLine'][$key]['Value'] = $new_product_titles[ $customs_items['Description'] ]['Value']; } if(!empty( $new_product_titles[ $customs_items['Description'] ]['Description'] )){ $request['Customs']['CustomsLines']['CustomsLine'][$key]['Description'] = $new_product_titles[ $customs_items['Description'] ]['Description']; } } } } return $request; }