missodessa
Forum Replies Created
-
so from the bulk actions drop down select “show purchased items” then select the ones you want to show and hit apply. The page will refresh and then you will see each item load. I am still learning coding myself so hopefully this was close to what you were asking for.
You can paste this into the purchased-items-column-woocommerce.php file (its the entire code)
add_action('before_woocommerce_init', function() {
if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
}
});
// Add Purchased Items Column
add_filter('manage_edit-shop_order_columns', function($columns) {
$new_array = [];
foreach ($columns as $key => $title) {
if ($key == 'billing_address') {
$new_array['order_items'] = __('Purchased', 'woocommerce');
}
$new_array[$key] = $title;
}
return $new_array;
});
add_action('manage_shop_order_posts_custom_column', function($column) {
if ($column == 'order_items') {
$order_id = (int) get_the_ID();
echo '<a href="#" class="show_order_items" data-wc-order="'.$order_id.'">'.__('Show items', 'purchased-items-column-woocommerce').'</a>';
echo '<div id="show_order_items_'.$order_id.'"></div>';
}
}, 10, 2);
// Add JS to handle showing items on click
add_action('admin_footer', function() {
if ((isset($_GET['page']) && $_GET['page'] == 'wc-orders') || (isset($_GET['post_type']) && $_GET['post_type'] == 'shop_order')) {
?>
<script>
jQuery(document).ready(function($) {
// Handle manual click on "Show Items" button
$(".show_order_items").click(function(e) {
e.preventDefault(); // Prevent default anchor behavior
let thisBtn = $(this);
let order_id = thisBtn.data('wc-order');
thisBtn.hide(); // Hide button after click
$('#show_order_items_'+order_id).html('loading...');
let data = {
'action': 'pipdig_wc_find_products_ajax',
'sec': '<?php echo wp_create_nonce('pipdig_wc_find_products_nonce'); ?>',
'order_id': order_id
};
$.post(ajaxurl, data, function(response) {
$('#show_order_items_'+order_id).html(response);
});
});
// Automatically click show items for bulk action orders
let bulkOrderIds = <?php echo json_encode(get_transient('bulk_show_items_order_ids')); ?>;
if (bulkOrderIds) {
bulkOrderIds.forEach(function(order_id) {
$(".show_order_items[data-wc-order='" + order_id + "']").trigger("click");
});
}
});
</script>
<?php
// Clear the transient after it's used
delete_transient('bulk_show_items_order_ids');
}
}, 999999);
// AJAX action to fetch order items
add_action('wp_ajax_pipdig_wc_find_products_ajax', function() {
check_ajax_referer('pipdig_wc_find_products_nonce', 'sec');
if (!function_exists('wc_get_order')) return;
$output = '';
$order_id = (int) $_POST['order_id'];
$order = wc_get_order($order_id);
if (!$order) wp_die();
// Exclude these meta keys from showing in the column
$excluded_meta_keys = array('_reduced_stock', '_restock_refunded_items');
foreach ($order->get_items() as $item) {
$product = $item->get_product();
$sku_info = '';
$meta_markup = '';
if ($product) {
$sku = $product->get_sku();
if ($sku) $sku_info = ' ('.esc_html($sku).')';
// Loop through product meta data and exclude unwanted attributes
foreach ($item->get_meta_data() as $meta_data) {
$meta_data_as_array = $meta_data->get_data();
// Skip excluded meta attributes
if (in_array($meta_data_as_array['key'], $excluded_meta_keys, true)) {
continue;
}
$value = $meta_data_as_array['value'];
$attribute = $meta_data_as_array['key'];
$attribute_name = wc_attribute_label($attribute, $product);
$name = $value;
$term = get_term_by('slug', $value, $attribute);
if ($term) {
$name = $term->name;
}
$meta_markup .= '<br>'.esc_html($attribute_name).': '.esc_html($name);
}
}
$quantity = (int) $item['quantity'];
$product_name = esc_html($item['name']);
$output .= $quantity.' × '.$product_name.$sku_info.$meta_markup.'<br /><br />';
}
echo $output;
wp_die();
});
// Add Bulk Action for Purchased Items
add_filter('bulk_actions-edit-shop_order', function($bulk_actions) {
$bulk_actions['show_purchased_items'] = __('Show Purchased Items', 'purchased-items-column-woocommerce');
return $bulk_actions;
});
// Handle Bulk Action to auto-expand purchased items
add_filter('handle_bulk_actions-edit-shop_order', function($redirect_to, $action, $order_ids) {
if ($action === 'show_purchased_items') {
// Store selected order IDs in transient for retrieval after page load
set_transient('bulk_show_items_order_ids', $order_ids, 60); // 60 seconds expiration
$redirect_to = add_query_arg('bulk_show_purchased_items', count($order_ids), $redirect_to);
}
return $redirect_to;
}, 10, 3);
// Admin Notice after bulk action
add_action('admin_notices', function() {
if (!empty($_REQUEST['bulk_show_purchased_items'])) {
$purchased_items_count = intval($_REQUEST['bulk_show_purchased_items']);
printf('<div id="message" class="updated notice is-dismissible"><p>' .
_n('%s order processed.', '%s orders processed.', $purchased_items_count, 'purchased-items-column-woocommerce') . '</p></div>', $purchased_items_count);
}
});I’ve actually tried to add something like this into the code myself and got it to work because I had the same issue with accidentally opening the order instead! I can send it to you to test if you would like.
Since updating to 1.8.2 the plugin now only shows the product and no variation attributes.
I hope you don’t mind but I have updated the plugin code myself so that it displays the way I want it to. Now all of the variations attributes are displaying when clicked.
This is the full code for the purchased-items-column-woocommerce.php while still hiding reduce stock attributes
<?php if (!defined('ABSPATH')) die;
/*
Plugin Name: Purchased Items Column WooCommerce
Plugin URI: https://www.ads-software.com/plugins/purchased-items-column-woocommerce/
Description: Display a "Purchased Items" column on the WooCommerce orders page.
Author: pipdig
Author URI: https://www.pipdig.co/
Version: 1.8.3
Requires Plugins: woocommerce
Text Domain: purchased-items-column-woocommerce
License: GPLv2 or later
*/
add_action('before_woocommerce_init', function() {
if (class_exists(\Automattic\WooCommerce\Utilities\FeaturesUtil::class)) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility('custom_order_tables', __FILE__, true);
}
});
// HPOS
add_filter('woocommerce_shop_order_list_table_columns', function ($columns) {
$new_array = [];
foreach ($columns as $key => $title) {
if ($key == 'billing_address') {
$new_array['order_items'] = __('Purchased', 'woocommerce');
}
$new_array[$key] = $title;
}
return $new_array;
});
// HPOS
add_action('woocommerce_shop_order_list_table_custom_column', function ($column, $order) {
if ($column == 'order_items') {
$order_id = (int) $order->get_id();
echo '<a href="#" class="show_order_items" data-wc-order="'.$order_id.'">'.__('Show items', 'purchased-items-column-woocommerce').'</a><div id="show_order_items_'.$order_id.'"></div>';
}
}, 10, 2);
// CPT
add_filter('manage_edit-shop_order_columns', function($columns) {
$new_array = [];
foreach ($columns as $key => $title) {
if ($key == 'billing_address') {
$new_array['order_items'] = __('Purchased', 'woocommerce');
}
$new_array[$key] = $title;
}
return $new_array;
});
// CPT
add_action('manage_shop_order_posts_custom_column', function($column) {
if ($column == 'order_items') {
$order_id = (int) get_the_ID();
echo '<a href="#" class="show_order_items" data-wc-order="'.$order_id.'">'.__('Show items', 'purchased-items-column-woocommerce').'</a><div id="show_order_items_'.$order_id.'"></div>';
}
}, 10, 2);
add_action('admin_footer', function() {
if ( (isset($_GET['page']) && $_GET['page'] == 'wc-orders') || (isset($_GET['post_type']) && $_GET['post_type'] == 'shop_order')) {
?>
<script>
jQuery(document).ready(function($) {
$(".show_order_items").click(function() {
let thisBtn = $(this);
let order_id = thisBtn.data('wc-order');
thisBtn.hide();
$('#show_order_items_'+order_id).html('loading...');
let data = {
'action': 'pipdig_wc_find_products_ajax',
'sec': <?php echo "'".wp_create_nonce('pipdig_wc_find_products_nonce')."'"; ?>,
'order_id': order_id
};
$.post(ajaxurl, data, function(response) {
$('#show_order_items_'+order_id).html(response);
});
});
});
</script>
<?php
}
}, 999999);
add_action('wp_ajax_pipdig_wc_find_products_ajax', function() {
check_ajax_referer('pipdig_wc_find_products_nonce', 'sec');
if (!function_exists('wc_get_order')) {
return;
}
$output = '';
$order_id = (int) $_POST['order_id'];
$order = wc_get_order($order_id);
if (!$order) {
wp_die();
}
// Exclude hidden meta attributes, like 'Reduce Stock'
$excluded_meta_keys = array('_reduced_stock', '_restock_refunded_items');
foreach ($order->get_items() as $item) {
$product = $item->get_product();
$sku_info = '';
$meta_markup = '';
if ($product) {
$sku = $product->get_sku();
if ($sku) {
$sku_info = ' ('.esc_html($sku).')';
}
// Loop through product meta data and exclude unwanted attributes
foreach ($item->get_meta_data() as $meta_data) {
$meta_data_as_array = $meta_data->get_data();
// Skip excluded meta attributes like 'Reduce Stock'
if (in_array($meta_data_as_array['key'], $excluded_meta_keys, true)) {
continue;
}
$value = $meta_data_as_array['value'];
$attribute = $meta_data_as_array['key'];
$attribute_name = wc_attribute_label($attribute, $product);
$name = $value;
$term = get_term_by('slug', $value, $attribute);
if ($term) {
$name = $term->name;
}
$meta_markup .= '<br>'.esc_html($attribute_name).': '.esc_html($name);
}
}
$quantity = (int) $item['quantity'];
$product_name = esc_html($item['name']);
$output .= $quantity.' × '.$product_name.$sku_info.$meta_markup.'<br /><br />';
}
echo $output;
wp_die();
});- This reply was modified 2 months ago by missodessa.
- This reply was modified 2 months ago by missodessa. Reason: edit code
Forum: Reviews
In reply to: [Purchased Items Column for WooCommerce Orders] ABSOLUTELY PERFECT!I have updated my review to reflect the great customer service. Again I really appreciate the quick response and the fix! Amazing work!
THANK YOU SO MUCH!!! I updated the plugin and now it seems to be showing attribute/variation items correctly. To respond to your other question. I actually only had two items under product/attributes (size and color) but they weren’t actually being used on any products. I will update my review you guys are excellent. This makes my work flow so much easier!
Forum: Fixing WordPress
In reply to: Malware keeps changing wp-includes/formatting.php fileI’ve been infected with this same thing. Im not sure if you ever got help but bits and pieces of posts from different sites helped me get it under control. My site was being redirected and also contained blog posts that went to poker sites with iframes.
- had my host run a scan on my server & removed the files it found. Look for anything similar in your site in the smae areas that just dont look like core files. (alternatively you could go to step 2 if you can)
/public_html/a4496f.php
/public_html/wp-admin/link-parse-opml-core.php
/public_html/hazmod.php
/public_html/wp-includes/class.wp-dependencies-private.php - once I deleted those files I was able to install wordfence and run a scan. it found more infected files. I updated the wordpress files except the wp-conent folder. Updated the plugins, removed unused themes, removed any weird wordpress users and deleted all the blog posts it created. I even changed all account passwords (web host/cpanel/email account/wordpress admins/ftp accounts)
- I still had the issue of one file reverting back with a string of code my wp-includes/plugin.php as soon as I removed the bit of code it was back after reopening the file. Your post led me to check my cron jobs and from there I saw the malicious code like yours. I was able to erase it and since then my plugin.php file has not updated with the string of code and my scans are clean so fingers crossed. It might be possible you have to delete some infected files before you can remove the cron job trying to run.
I truly hope if anyone find themselves here that this helps because I couldnt even find anything mentioning this exact backdoor but this post and if you need help my username is the same on social media platforms so you can reach out.
- This reply was modified 1 year, 2 months ago by missodessa. Reason: added info
- This reply was modified 1 year, 2 months ago by missodessa.
Forum: Plugins
In reply to: [Advanced Product Fields (Product Addons) for WooCommerce] Cant set upThank you so much for the response.
I reactivated the plugin switched the theme to the “twenty twenty” theme and it seems to show up now so it is indeed an issue with theme compatibility. Is there some bit of code I need to add to actually make it show up since the theme Im using has obviously formatted their single product pages to look/work a certain way?
I am using a theme from themeforest called dorian.
https://themeforest.net/item/dorian-refined-multiconcept-wordpress-theme/15675655I am getting this same error but I am using reCAPTCHA v3 when I remove the keys from the integration page my forms start working again.
Everything was working fine until until I updated the plugin and was forced to set up
reCAPTCHA again.- This reply was modified 5 years, 8 months ago by missodessa.
- This reply was modified 5 years, 8 months ago by missodessa.
Forum: Plugins
In reply to: [Contact Form 7] Wont send mail on php 7.1unfortunately I have tried all of these and I have 2 sites on the same hosting account with the same exact setup (plugin and theme) and it seems to be one site giving me the issue which is why Im having such a hard time figuring it out.
I disabled all plugins put it to a default theme nothing changed the issue other than changing the specific site to php 5.5 Its racking my brain and even my host has no explanation as to why my mail refuses to send on php 7.1 they have looked at error logs and everything.
Forum: Plugins
In reply to: [Pay For Post with WooCommerce] Post visible and the order is not completedWhat are your woocommerce download settings?
woocommerce>settings>products>downloadable products
check “Grant access to downloadable products after payment”
I’m currently wondering the same thing.
EDIT*
I just did a test run and put through a completed order for myself.
I have ONE product that gives access to page A and page B.
On a seperate page I have used the following shortcode.
[woocommerce-payperpost template=’purchased’]And both pages A and B show up in a list as what was purchased.
- This reply was modified 6 years, 7 months ago by missodessa.
Forum: Plugins
In reply to: [Contact Form 7] Thank you pageWhen you go to create your form click on the additional settings tab and paste in this code
on_sent_ok: "location = 'https://example.com/';"
replace https://example.com/ with the url you want your visitor to be sent to.
instructions also found here
https://contactform7.com/redirecting-to-another-url-after-submissions/Forum: Plugins
In reply to: [Simple Instagram] instagram revoke access not workinglogin to your instagram from your computer. Go into your settings
you will see a link for “apps” click it find the simple instagram app and revoke its access.Then you can go back into your wordpress and log back in.
My login seems to be working however now I can’t figure out how to reactivate the plugin for the pro version. I see my serial key but I also see next to the order on your site “renew now” for $25 are your plugins only good for a year and then we have to pay extra to keep them working? No where currently on your site or when purchased this did it mention the fee was only for a year of service. It’s already expensive at $47 but another $25 a year seems a bit steep esp since I have noticed even now that its updated some of the stats don’t work or don’t show accurately. Please let me know if I need to pay or if I am missing something?
Forum: Plugins
In reply to: [YITH WooCommerce Product Gallery & Image Zoom] Thumbnails offI was actually able to override the inline/element css so I could change the height of the slider even though I couldn’t find it anywhere in the coding actually I think I found it…but it looks to be embeded in the jquery.carouFredSel.js on line 2734 Im not 100% sure it was the only file that references the class caroufredsel_wrapper but I fixed it by adding the following into my frontend.css in the plugin’s files.
.caroufredsel_wrapper { height: 190px !important; }
with out the !important added it
would not work.