maciek8
maciek8

Reputation: 35

Display product attributes for variations everywhere (backend + frontend + email notifications) in woocommerce 3

How do I display a product category and it's variations everywhere on orders (backend + frontend + email notifications)?

I am writing about this question: Display product attributes for variations on cart page in woocommerce 3

I found one problem after applying these changes: Product variations attributes as cart items shows up differently in WooCommerce

After adding a line:

add_filter ('woocommerce_product_variation_title_include_attributes', '__return_false');

It stops displaying the attributes on the back-end order page.

After removing this line, it shows the attributes on the back-end order page but stops displaying them in the cart page.

I need to get that display everywhere on orders (backend + frontend + email notifications).

Upvotes: 1

Views: 718

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253804

Try the following:

add_filter ('woocommerce_product_variation_title_include_attributes', function( $should_include_attributes, $product ){
    // Only on front-end
    if( ! is_admin() )
        $should_include_attributes = false;

    return $should_include_attributes;
}, 20, 2 );

Code goes in function.php file of your active child theme (or active theme). It should work.

Upvotes: 2

Related Questions