Last active
February 17, 2021 15:16
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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