Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
Last active February 17, 2021 15:16
Show Gist options
  • Save damiencarbery/9cbd25fdbcea4b887709b1b4d7fa64b7 to your computer and use it in GitHub Desktop.
Save damiencarbery/9cbd25fdbcea4b887709b1b4d7fa64b7 to your computer and use it in GitHub Desktop.
Display attribute name and value in WooCommerce -Show the attribute name beside the attribute value in WooCommerce (in Cart, Checkout and order emails). https://www.damiencarbery.com/2019/09/display-attribute-name-and-value-in-woocommerce/
<?php
/*
Plugin Name: Display attribute name and value in WooCommerce
Plugin URI: https://www.damiencarbery.com/2019/09/display-attribute-name-and-value-in-woocommerce/
Description: Show the attribute name beside the attribute value in WooCommerce (in Cart, Checkout and order emails).
Author: Damien Carbery
Version: 0.2
*/
add_filter( 'woocommerce_product_variation_title_include_attributes', 'dcwd_product_variation_title_include_attributes', 10, 2 );
function dcwd_product_variation_title_include_attributes( $should_include_attributes, $product ) {
// Returning false messes up My Account/Downloads page - thanks for Leandro for reporting.
if ( is_account_page() ) { return $should_include_attributes; }
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment