Affirm Banner | Q2 2024

added by Latoya

Product Icon

Product Add-Ons

Offer add-ons like gift wrapping, special messages or other special options for your products.

Product id’s in global selector

It would be great if we could add product ids in the global instead of only categories. Im currently using the categories and if i should add a global to that category it won’t be correct, because not all products have the add-ons. I know i can add on the single product and also remove all globals from the product. I just think in my case it would be more convenient to add product id’s in the global add-ons. Thanks for reading 🙂

Author

Current Status

Open

Last updated: July 30, 2018

1 comment

Log in to comment on this feature request.

  1. woomigrating says:

    I was in desperate need of this feature (and would still very much like to see it implemented) but I found a temp solution I would like to share.

    I created a category to put products in (let’s say “add-on-1”).
    Addes the individual products to add-on-1.
    (now problem was that category add-on-1 displayed on the product pages meta and site map)

    I used the following plugin to hide the category from front:
    https://codecanyon.net/item/woocommerce-products-visibility-hide-or-show-by-user-role/18587731
    (to make this work properly codemine created the following snippets for me, *awesome support*)

    add_filter(‘wcpv_visibility_only_selected_tax’, ‘wcpv_show_tax’);
    function wcpv_show_tax() {
    return true;
    }

    add_action(‘init’, ‘wcpv_exclude_rules_for_products’, 10);
    function wcpv_exclude_rules_for_products() {
    if (class_exists(‘WCPV_FRONTEND’)) {
    $wcpv_frontent = WCPV_FRONTEND::get_instance();
    remove_filter(‘posts_where_paged’, array($wcpv_frontent, ‘wcpv_products’), 1, 2);
    }
    }

    add_filter(‘get_product_addons_product_terms’, ‘override_global_addon_cached_terms’, 10, 2);
    function override_global_addon_cached_terms($product_terms, $post_id) {
    if (class_exists(‘WCPV_FRONTEND’)) {
    $wcpv_frontent = WCPV_FRONTEND::get_instance();
    remove_filter(‘get_terms’, array($wcpv_frontent, ‘wcpv_get_terms’), 10, 3);
    $product_terms = wp_get_post_terms($post_id, ‘product_cat’, array(‘fields’ => ‘ids’));
    add_filter(‘get_terms’, array($wcpv_frontent, ‘wcpv_get_terms’), 10, 3);
    }
    return $product_terms;
    }

    Maybe this can help other people until Automattic gets their thumbs free to implement such a crusial feature in their not so low priced plugin!