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 :: is replace case sensitive php 
Php :: how to use seeders in laravel 
Php :: convert array into , separated string in php 
Php :: wordpress image size name 
Php :: wherein elequent 
Php :: php mysql insert timestamp now 
Php :: how naming resource routes laravel 
Php :: check website ssl certificate using php 
Php :: strict types php 
Php :: check array is associative laravel 
Php :: php string interpolation 
Php :: php artisan route list does not show all my routes 
Php :: filesize in php 
Php :: test post request laravel 
Php :: axios post not sending data php 
Php :: check if date has passed php 
Php :: laravel where in array 
Php :: Access-Control-Allow-Origin php laravel 
Php :: laravel model withCount relationship condition 
Php :: php invoke 
Php :: composer autoload 
Php :: h:i:s explode in php by ":" 
Php :: fakher ul islam khan 
Php :: php get 
Php :: create excel file using php] 
Php :: give @s potion off weekness 
Php :: real time update using ajax php 
Php :: python to php 
Php :: db seed in controller 
Php :: Advanced Custom Fields get sub field image 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =