Code works for Parent theme but not child theme?
-
I have added custom code to my functions.php file. The code allows RRP and Price to be displayed on my WooCommerce orders page, which then allows our invoices to work correctly.
Unfortunately, since creating a child theme the code brings a critical error to my site. Are you able to make adjustments to the code below to allow it to work with my child theme?
/* Add original price column to admin order summary */
add_action( 'woocommerce_admin_order_item_headers', 'pd_admin_order_items_headers' );
function pd_admin_order_items_headers($order){
?>
RRP
Price
<?php
} add_action('woocommerce_admin_order_item_values', 'my_woocommerce_admin_order_item_values', 10, 3);
function my_woocommerce_admin_order_item_values($_product, $item, $item_id = null) {
echo '' . $_product->get_price_html() . '';
echo '' . wc_price($item->get_subtotal()/$item->get_quantity()) . '';
} /* Add original pricing to invoice */
add_filter('wf_pklist_alter_product_table_head', 'wt_pklist_add_product_column', 10, 3);
function wt_pklist_add_product_column($columns_list_arr, $template_type, $order)
{
if($template_type == 'invoice')
{
$out=array();
foreach ($columns_list_arr as $key => $value)
{
$out[$key]=$value;
if($key == 'quantity' || $key == '-quantity')
{
$out['wfte_product_original_price']=__('RRP');
}
}
$columns_list_arr=$out;
}
return $columns_list_arr;
} add_filter('wf_pklist_product_table_additional_column_val','wt_pklist_add_custom_col_vl',10,6);
function wt_pklist_add_custom_col_vl($column_data, $template_type, $columns_key, $_product, $order_item, $order)
{
if($template_type == 'invoice')
{
if($columns_key=='wfte_product_original_price')
{
$column_data=$_product->get_price_html();
}
}
return $column_data;
}Hope you are able to help.
Kind Regards,
Leon
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Code works for Parent theme but not child theme?’ is closed to new replies.