Created
February 17, 2014 21:07
-
-
Save emoop/9059144 to your computer and use it in GitHub Desktop.
Get product custom field when get product in Woocmmerce REST API
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 | |
/* if you have get a custom field use this filter*/ | |
add_filter('woocommerce_api_product_response','get_custom_field'); | |
// '_brand' is my custom field | |
function get_custom_field($product){ | |
$product['brand']=get_post_meta($product['id'],'_brand',true); | |
return $product; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exactly what I was looking for!