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; | |
} |
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
add_action( 'woocommerce_after_shop_loop_item_title','display_sizes' ); | |
function display_sizes(){ | |
global $product; | |
$variations=$product->get_available_variations(); | |
$count=sizeof($variations); | |
$counter=0; | |
echo '<span class="sizes">Sizes:';//sizes or whatever u want | |
foreach($variations as $var){ | |
foreach($var['attributes'] as $name=>$val){ |