Get variation name from $cart_item
-
How do I get this element
'name' => string 'I'm the product variation name'
from the following array:var_dump($cart_item):
array (size=14) 'bundled_by' => string '069b139322bae79c5d037b0d79ece9e8' (length=32) 'stamp' => array (size=1) 1 => array (size=5) 'product_id' => int 230 'quantity' => int 1 'attributes' => array (size=1) ... 'variation_id' => string '235' (length=3) 'discount' => string '' (length=0) 'bundled_item_id' => int 1 'key' => string '52d070f89cd3a50de5654bbce58ea9c4' (length=32) 'product_id' => int 230 'variation_id' => int 235 'variation' => array (size=1) 'attribute_pa_flavor' => string 'pear-flavor' (length=15) 'quantity' => int 1 'line_tax_data' => array (size=2) 'subtotal' => array (size=0) empty 'total' => array (size=0) empty 'line_subtotal' => float 15.99 'line_subtotal_tax' => int 0 'line_total' => float 15.99 'line_tax' => int 0 'data' => object(WC_Product_Variation)[2477] protected 'post_type' => string 'product-variation' (length=17) protected 'parent_data' => array (size=14) 'title' => string 'Bubble Gum' (length=18) 'sku' => string '' (length=0) 'manage_stock' => string 'no' (length=2) 'backorders' => string 'no' (length=2) 'stock_quantity' => int 0 'weight' => string '' (length=0) 'length' => string '' (length=0) 'width' => string '' (length=0) 'height' => string '' (length=0) 'tax_class' => string '' (length=0) 'shipping_class_id' => int 0 'image_id' => string '' (length=0) 'purchase_note' => string '' (length=0) 'catalog_visibility' => string 'visible' (length=7) protected 'object_type' => string 'product' (length=7) protected 'cache_group' => string 'products' (length=8) protected 'data' => array (size=48) 'name' => string 'I'm the product variation name' (length=36) 'slug' => string 'im-the-product-variation-slug' (length=34) 'date_created' => object(WC_DateTime)[2486] ... 'date_modified' => object(WC_DateTime)[2489] ... 'status' => string 'publish' (length=7) 'featured' => boolean false, ...
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get variation name from $cart_item’ is closed to new replies.