Home › Forums › WoodMart support forum › Unable to customize the woocommerce order area on backend
Unable to customize the woocommerce order area on backend
- This topic has 16 replies, 2 voices, and was last updated 8 months, 3 weeks ago by Aizaz Imtiaz Awan.
-
AuthorPosts
-
March 8, 2024 at 4:45 pm #547483
refaParticipantHi,
I noticed an issue, when I try to customize the woocommerce -> order area filter from the backend it’s not showing. When I tried with a different theme (storefront theme) it appeared, how to resolve this?
I attached the screenshots below for your reference.
Thank you,
March 9, 2024 at 10:31 am #547594
Aizaz Imtiaz AwanKeymasterI have tested this code on our test site and it is working. Try to add the following code in the function.php of the child theme.
// Custom function where metakeys / labels pairs are defined function get_filter_shop_order_meta( $domain = 'woocommerce' ){ // Add below the metakey / label pairs to filter orders return [ '_billing_company' => __('Billing company', $domain), '_order_total' => __('Gran total', $domain), ]; } // Add a dropdown to filter orders by meta add_action( 'restrict_manage_posts', 'display_admin_shop_order_by_meta_filter' ); function display_admin_shop_order_by_meta_filter(){ global $pagenow, $typenow; if( 'shop_order' === $typenow && 'edit.php' === $pagenow ) { $domain = 'woocommerce'; $filter_id = 'filter_shop_order_by_meta'; $current = isset($_GET[$filter_id])? $_GET[$filter_id] : ''; echo '<select name="'.$filter_id.'"> <option value="">' . __('Filter by meta…', $domain) . '</option>'; $options = get_filter_shop_order_meta( $domain ); foreach ( $options as $key => $label ) { printf( '<option value="%s"%s>%s</option>', $key, $key === $current ? '" selected="selected"' : '', $label ); } echo '</select>'; } } // Process the filter dropdown for orders by Marketing optin add_filter( 'request', 'process_admin_shop_order_marketing_by_meta', 99 ); function process_admin_shop_order_marketing_by_meta( $vars ) { global $pagenow, $typenow; $filter_id = 'filter_shop_order_by_meta'; if ( $pagenow == 'edit.php' && 'shop_order' === $typenow && isset( $_GET[$filter_id] ) && ! empty($_GET[$filter_id]) ) { $vars['meta_key'] = $_GET[$filter_id]; $vars['orderby'] = 'meta_value'; } return $vars; } // (Optional) Make a custom meta field searchable from the admin order list search field add_filter( 'woocommerce_shop_order_search_fields', 'shop_order_meta_search_fields', 10, 1 ); function shop_order_meta_search_fields( $meta_keys ){ foreach ( get_filter_shop_order_meta() as $meta_key => $label ) { $meta_keys[] = $meta_key; } return $meta_keys; }
March 11, 2024 at 8:11 am #547843
refaParticipantI tried still it’s not showing. When I changed the theme it showed.
Please find the screenshot below for the same.- This reply was modified 9 months, 1 week ago by refa.
March 11, 2024 at 10:57 am #547906
Aizaz Imtiaz AwanKeymasterHello,
Can you please share the WP admin login details of your site so I will check and give you a possible solution.
Best Regards.
March 11, 2024 at 11:23 am #547922
refaParticipantPlease find the credentials below.
If you want to deactivate any plugin temporarily to test, please do.
Please use the child theme for the functions.March 11, 2024 at 4:18 pm #548078
Aizaz Imtiaz AwanKeymasterHello,
Sorry to say but right now we are unable to access your Dashboard due to a critical error.
Could you please share your Site’s FTP Login details too so that we can further check?
Best Regards
March 12, 2024 at 8:59 am #548301
refaParticipantDue to some reason, I can’t provide FTP credentials. I resolved the critical error can you check now?
March 12, 2024 at 1:27 pm #548425
Aizaz Imtiaz AwanKeymasterHello,
I have checked this code with the default woocommerce theme and it is still the same.
See screenshot for clarification:
https://ibb.co/bWLjVM4Such modification requires complicated code customization which is not covered by our support. All the customizations made in the theme files are at your own risk. Our support doesn’t cover any issues caused by changes in the theme code.
Best Regards.
March 13, 2024 at 11:36 am #548735
refaParticipantI tried it on my testing site, and it’s working fine there. That’s why I asked for the support.
It’s not working on my live site. I used the same code, I used on the Woodmart child theme only.Check the screenshots for your reference.
If you want to check the testing site, please check I shared the credentials below.
March 13, 2024 at 3:42 pm #548843
Aizaz Imtiaz AwanKeymasterHello,
Such modification requires complicated code customization which is not covered by our support. All the customizations made in the theme files are at your own risk. Our support doesn’t cover any issues caused by changes in the theme code.
You need to find a third party plugin to achieve more functionality that best suits you. We have not tested such kinds of plugins, so we don’t have any detailed suggestions
https://wordpress.org/plugins/additional-order-filters-for-woocommerce/Best Regards.
March 25, 2024 at 10:38 am #551915
refaParticipantI tried that plugin but it didn’t work for me.
The customization I tried on the Woocommerce -> Orders page is not working even if it is a plugin or custom code it doesn’t matter, I don’t know why. I also tried with the below code to add a Time column on the Woocommerce -> Order page that also didn’t work.
/* Add time column to the woocommerce orders area */
function custom_shop_order_column_headers($columns)
{
$new_columns = array();foreach ($columns as $key => $column) {
$new_columns[$key] = $column;
if ($key === ‘order_date’) {
$new_columns[‘order_time’] = __(‘Time’, ‘woocommerce’);
}
}return $new_columns;
}
add_filter(‘manage_edit-shop_order_columns’, ‘custom_shop_order_column_headers’);// Display Date and Time in custom column
function custom_shop_order_column_content($column)
{
global $post, $the_order;if ($column === ‘order_time’) {
if (empty($the_order)) {
$the_order = wc_get_order($post->ID);
}if ($the_order) {
echo ‘<time datetime=”‘ . esc_attr($the_order->get_date_created()->date(‘c’)) . ‘”>’ . esc_html($the_order->get_date_created()->date(‘H:i’)) . ‘</time>’;
}
}
}
add_action(‘manage_shop_order_posts_custom_column’, ‘custom_shop_order_column_content’);Attachments:
You must be logged in to view attached files.March 25, 2024 at 2:52 pm #552060
Aizaz Imtiaz AwanKeymasterHello,
Such modification requires complicated code customization which is not covered by our support. All the customizations made in the theme files are at your own risk. Our support doesn’t cover any issues caused by changes in the theme code.
Best Regards.
March 26, 2024 at 8:30 am #552197
refaParticipantYou didn’t get about my issue, the issue is not with the code. Even if I install any plugin related to Woocommerce -> Order page on the backend is not work for me. That too on only this site, I have another site with the same woodmart theme there it’s working.
For example this plugin
https://wordpress.org/plugins/additional-order-filters-for-woocommerce/
This plugin or the custom code that I mentioned in my previous message is not working only on this site, on the other site both are working. I am using the same theme and the same set of plugins on both sites.
I hope you understand about the issue.
March 26, 2024 at 9:42 am #552207
refaParticipantJust now I noticed both links/endpoints are different.
The customization working endpoint is “/wp-admin/edit.php?post_type=shop_order”
and not working endpoint is “/wp-admin/admin.php?page=wc-orders”How to change my endpoint to the working one?
Please find the attached screenshot for your reference.
Thank you,
March 26, 2024 at 11:17 am #552252
Aizaz Imtiaz AwanKeymasterHello,
I suggest disable all plugins except these ones:
Elementor or WPBackary
Woodmart Core
WooCommerce
Enable the Parent themeThen activate the plugins one by one, checking the issue to detect which one causes the problem.
If the issue remains, check how it works with some default WordPress themes like TwentyTwenty or WooCommerce Storefront to understand if it is our theme issue or not because it is related to woocommerce customization.
Best Regards.
March 26, 2024 at 11:20 am #552255
refaParticipantI resolved the issue.
It’s because of the woocommerce High-performance order storage feature.
March 26, 2024 at 1:22 pm #552343
Aizaz Imtiaz AwanKeymasterHello,
You are Most Welcome.
We are glad that you managed to solve the problem yourself. You are Great!!!
Let us know if there’s anything else we can do for you! You can always reach us at any time. We are always here to help you.
Have a wonderful day.
Topic Closed.
Best Regards. -
AuthorPosts
The topic ‘Unable to customize the woocommerce order area on backend’ is closed to new replies.
- You must be logged in to create new topics. Login / Register