
first we need to modify two scripts, one for the backend, other for the frontend, lets start with the backend
1-)inside /wp-content/plugins/woocommerce-openpos/includes/admin/Admin.php, stock_products() function:
//custom fields - by ahmad naser
$product_cost = get_post_meta($product_id, '_op_cost_price', true);
$product_profit_signle = $price - $product_cost;
$product_profit = "(". $product_profit_signle.") - {".($tmp['total_qty'] * $product_profit_signle)."}" ;
$product_capital = $tmp['total_qty'] * $product_cost ;
$tmp['product_cost'] = $product_cost;
$tmp['product_profit'] = $product_profit;
$tmp['product_capital'] = $product_capital;
$rows[] = apply_filters('op_warehouse_stock_row_data',$tmp,$post,$warehouse_id);
2-We need to modify the view, for the page wp-admin/admin.php?page=op-stock, so the needed file is /www/wwwroot/nadaalazhar.com/wp-content/plugins/woocommerce-openpos/templates/admin/stock.php
<!-- Custom Columns-->
<th data-column-id="product_cost" data-sortable="false">التكلفة</th>
<th data-column-id="product_profit" data-sortable="false">هامش الربح</th>
<th data-column-id="product_capital" data-sortable="false">راس المال </th>
<!-- /Custom Columns-->
<th data-column-id="action" data-sortable="false" style="text-align: center"><?php echo __( 'Action', 'openpos' ); ?></th>
That is it :), the end result as following:

in order to search file system, you might use
find ./ -type f -exec grep -H 'op_stock_products' {} \;
Leave a Reply