Created
February 12, 2014 01:21
-
-
Save EricBusch/8948125 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* Add color attribute. | |
* | |
* The attribute "Color" with a slug of "color" must already exist here: | |
* WordPress Admin Area > Products > Attributes. | |
*/ | |
add_filter( 'dfrpswc_filter_attribute_value', 'mycode_add_color_attribute', 20, 6 ); | |
function mycode_add_color_attribute( $value, $attribute, $post, $product, $set, $action ) { | |
if ( $attribute == 'pa_color') { | |
if ( isset( $product['color'] ) ) { | |
$value = $product['color']; | |
} | |
} | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment