• Resolved missodessa

    (@missodessa)


    I left a review the other day and noticed you guys just added the feature to view variations in the list which is what I really needed. Im not sure if they are working as they should some products show the variation item name with the selected option and some don’t. In fact most don’t show. I looked at the way the products were set up and there is nothing setup different to my knowledge that should be causing an issue.

    For example the the purchased column the item ordered shows up like this when it seems to be working:


    1 × Get Lost in Me Page Holder – Get lost in me [Engraving: Get lost in me]

    But I have ones that display the variation like this:

    1 × Flower Power Suncatcher [Color: ]

    Instead of showing [Color: Neon Pink] the actual color selected is just blank. Is there something I am missing or is this a bug??

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author pipdig

    (@pipdig)

    Hi @missodessa,

    We did indeed add this to the plugin based on your feedback, thanks!

    I think this issue might be due to a product attribute being created on a product page, for that single product only. Rather than the attribute being created globally at the “Products > Attributes” page in the dashboard. If you go to the “Products > Attributes” page, is Color and Engraving both listed there? Or maybe just one of them is listed?

    View post on imgur.com

    Plugin Author pipdig

    (@pipdig)

    Hi @missodessa, we just pushed update 1.8.1 which I think should help with this. Let me know if those items are displayed correctly after updating today.

    Thread Starter missodessa

    (@missodessa)

    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!

    Plugin Author pipdig

    (@pipdig)

    @missodessa that’s great! Really glad to hear the update has helped. Thanks for updating your review also

    nicobonfa

    (@nicobonfa)

    Would it be possible to deselect this option? The list of products is now showing attributes added by other plugins, like expected shipping date, also with formatting bug.

    Example:

    PRODUCT NAME
    Stock Status: <p class=”stock in-stock in_stock_color woo-custom-stock-status woocss_shortcode”>Handmade to order. Ships in: 1-2 weeks</p>

    Or any way to download the previous version of the plugin?

    Plugin Author pipdig

    (@pipdig)

    Hi @nicobonfa,

    Currently the plugin will hide any attributes which WooCommerce core hides by default, but we can add further items that may be suitable.

    Is it just “Stock Status” that seems to be showing? Or are there other attributes that you’d also like to hide? I’ve just pushed update 1.8.2 which should hide that. Let me know if there are any others that would be useful to hide also.

    EDIT: I’ve changed the plugin further since posting the above info, so only attributes which are created manually are included. This should hide any random system attributes from showing up. Let me know if the latest update is showing the attributes you want, and hiding the others.

    nicobonfa

    (@nicobonfa)

    Thank you so much for the quick reply!
    Yes, the stock status is gone. I now see manually created attributes. Some items have two attributes, but only one is shown. Generally, I do not really need to see such attributes. It would be great to have the chance to hide the attributes, or having the chance to keep an older versions of the plugin for those who do not need it? Thanks again, excellent service!

    Thread Starter missodessa

    (@missodessa)

    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.' &times; '.$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
Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.