Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wp php get product item attributes name

$args = array(
    'category'  => array( 'category_slug' )
    // or 'term_taxonomy_id' => 4 i.e. category ID
);

foreach( wc_get_products($args) as $product ){

    foreach( $product->get_attributes() as $attr_name => $attr ){

        echo wc_attribute_label( $attr_name ); // attr label
        // or get_taxonomy( $attr_name )->labels->singular_name;

        foreach( $attr->get_terms() as $term ){

            echo $term->name;
        }
    }
}
Comment

wp php get product attribute name without pa

$taxonomy   = 'pa_size';
$label_name = wc_attribute_label( $taxonomy );
Comment

PREVIOUS NEXT
Code Example
Php :: php Write a program to reverse an array or string 
Php :: extract email from text 
Php :: tina4 save file to database in orm 
Php :: 200usd to php 
Php :: laravel 7 link to another page with language prefix 
Php :: exe:/usr/local/bin/php 
Php :: form validation in php 
Php :: rename image file using post id in wordpress programmatically 
Php :: How to calculate age using query builder in laravel? 
Php :: PHP number_format — Format a number with grouped thousands 
Php :: php array sum common values by key 
Php :: codeigniter 4 multiple validate error 
Php :: laravel gigapay update invoice 
Php :: js data php 
Php :: Convert Shamsi Jalali Persian Date TimeStamp 
Php :: how-to-add-pagination-in-search-results wordpress 
Php :: foreach in json object php 
Php :: Yii2 hasMany relation additional condition 
Php :: onde que fica a praia escondida no roblox jo mulher maravilha 
Php :: hide my echo from page php 
Php :: Convert Array Value Session Value To String PHP 
Php :: laravel error reporting code for view 
Php :: laravel list get x amount in a collection 
Php :: HP officejet pro 8720 default password 
Php :: ifmodule condition in htaccess 
Php :: laravel openstreetmap 
Php :: php imap before date subject 
Php :: woocommerce validar campos personalizados en el checkout 
Php :: php doesnt load updates in css 
Php :: php recapcha 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =