Last active
August 6, 2021 19:37
-
-
Save RadGH/fe792d86eec98f8634e58999b06f3ebf to your computer and use it in GitHub Desktop.
WooCommerce: $cart_item var_dump
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 | |
foreach( WC()->cart->get_cart_contents() as $cart_item_key => $cart_item ) { | |
var_dump($cart_item); | |
exit; | |
} | |
?> | |
array(13) { | |
["key"]=> | |
string(32) "c3804daac5b8859f0975d20c9fe3370e" | |
["product_id"]=> | |
int(39416) | |
["variation_id"]=> | |
int(0) | |
["variation"]=> | |
array(0) { | |
} | |
["quantity"]=> | |
int(5) | |
["data_hash"]=> | |
string(32) "b5c1d5ca8bae6d4896cf1807cdf763f0" | |
["line_tax_data"]=> | |
array(2) { | |
["subtotal"]=> | |
array(0) { | |
} | |
["total"]=> | |
array(0) { | |
} | |
} | |
["line_subtotal"]=> | |
float(0) | |
["line_subtotal_tax"]=> | |
int(0) | |
["line_total"]=> | |
float(0) | |
["line_tax"]=> | |
int(0) | |
["available_quantity"]=> | |
int(4) | |
["data"]=> | |
object(WC_Product_Simple)#3496 (12) { | |
["object_type":protected]=> | |
string(7) "product" | |
["post_type":protected]=> | |
string(7) "product" | |
["cache_group":protected]=> | |
string(8) "products" | |
["data":protected]=> | |
array(49) { | |
["name"]=> | |
string(31) "Dare To Lead Certification Exam" | |
["slug"]=> | |
string(31) "dare-to-lead-certification-exam" | |
["date_created"]=> | |
object(WC_DateTime)#3573 (4) { | |
["utc_offset":protected]=> | |
int(-21600) | |
["date"]=> | |
string(26) "2019-03-10 02:54:21.000000" | |
["timezone_type"]=> | |
int(1) | |
["timezone"]=> | |
string(6) "+00:00" | |
} | |
["date_modified"]=> | |
object(WC_DateTime)#3572 (4) { | |
["utc_offset":protected]=> | |
int(-21600) | |
["date"]=> | |
string(26) "2019-03-11 05:05:57.000000" | |
["timezone_type"]=> | |
int(1) | |
["timezone"]=> | |
string(6) "+00:00" | |
} | |
["status"]=> | |
string(7) "publish" | |
["featured"]=> | |
bool(false) | |
["catalog_visibility"]=> | |
string(7) "visible" | |
["description"]=> | |
string(0) "" | |
["short_description"]=> | |
string(0) "" | |
["sku"]=> | |
string(0) "" | |
["price"]=> | |
string(1) "0" | |
["regular_price"]=> | |
string(1) "0" | |
["sale_price"]=> | |
string(0) "" | |
["date_on_sale_from"]=> | |
NULL | |
["date_on_sale_to"]=> | |
NULL | |
["total_sales"]=> | |
int(0) | |
["tax_status"]=> | |
string(7) "taxable" | |
["tax_class"]=> | |
string(0) "" | |
["manage_stock"]=> | |
bool(false) | |
["stock_quantity"]=> | |
NULL | |
["stock_status"]=> | |
string(7) "instock" | |
["backorders"]=> | |
string(2) "no" | |
["low_stock_amount"]=> | |
string(0) "" | |
["sold_individually"]=> | |
bool(false) | |
["weight"]=> | |
string(0) "" | |
["length"]=> | |
string(0) "" | |
["width"]=> | |
string(0) "" | |
["height"]=> | |
string(0) "" | |
["upsell_ids"]=> | |
array(0) { | |
} | |
["cross_sell_ids"]=> | |
array(0) { | |
} | |
["parent_id"]=> | |
int(0) | |
["reviews_allowed"]=> | |
bool(false) | |
["purchase_note"]=> | |
string(0) "" | |
["attributes"]=> | |
array(0) { | |
} | |
["default_attributes"]=> | |
array(0) { | |
} | |
["menu_order"]=> | |
int(0) | |
["virtual"]=> | |
bool(true) | |
["downloadable"]=> | |
bool(false) | |
["category_ids"]=> | |
array(1) { | |
[0]=> | |
int(96) | |
} | |
["tag_ids"]=> | |
array(0) { | |
} | |
["shipping_class_id"]=> | |
int(0) | |
["downloads"]=> | |
array(0) { | |
} | |
["image_id"]=> | |
string(0) "" | |
["gallery_image_ids"]=> | |
array(0) { | |
} | |
["download_limit"]=> | |
int(-1) | |
["download_expiry"]=> | |
int(-1) | |
["rating_counts"]=> | |
array(0) { | |
} | |
["average_rating"]=> | |
string(1) "0" | |
["review_count"]=> | |
int(0) | |
} | |
["supports":protected]=> | |
array(1) { | |
[0]=> | |
string(16) "ajax_add_to_cart" | |
} | |
["id":protected]=> | |
int(39416) | |
["changes":protected]=> | |
array(0) { | |
} | |
["object_read":protected]=> | |
bool(true) | |
["extra_data":protected]=> | |
array(0) { | |
} | |
["default_data":protected]=> | |
array(49) { | |
["name"]=> | |
string(0) "" | |
["slug"]=> | |
string(0) "" | |
["date_created"]=> | |
NULL | |
["date_modified"]=> | |
NULL | |
["status"]=> | |
bool(false) | |
["featured"]=> | |
bool(false) | |
["catalog_visibility"]=> | |
string(7) "visible" | |
["description"]=> | |
string(0) "" | |
["short_description"]=> | |
string(0) "" | |
["sku"]=> | |
string(0) "" | |
["price"]=> | |
string(0) "" | |
["regular_price"]=> | |
string(0) "" | |
["sale_price"]=> | |
string(0) "" | |
["date_on_sale_from"]=> | |
NULL | |
["date_on_sale_to"]=> | |
NULL | |
["total_sales"]=> | |
string(1) "0" | |
["tax_status"]=> | |
string(7) "taxable" | |
["tax_class"]=> | |
string(0) "" | |
["manage_stock"]=> | |
bool(false) | |
["stock_quantity"]=> | |
NULL | |
["stock_status"]=> | |
string(7) "instock" | |
["backorders"]=> | |
string(2) "no" | |
["low_stock_amount"]=> | |
string(0) "" | |
["sold_individually"]=> | |
bool(false) | |
["weight"]=> | |
string(0) "" | |
["length"]=> | |
string(0) "" | |
["width"]=> | |
string(0) "" | |
["height"]=> | |
string(0) "" | |
["upsell_ids"]=> | |
array(0) { | |
} | |
["cross_sell_ids"]=> | |
array(0) { | |
} | |
["parent_id"]=> | |
int(0) | |
["reviews_allowed"]=> | |
bool(true) | |
["purchase_note"]=> | |
string(0) "" | |
["attributes"]=> | |
array(0) { | |
} | |
["default_attributes"]=> | |
array(0) { | |
} | |
["menu_order"]=> | |
int(0) | |
["virtual"]=> | |
bool(false) | |
["downloadable"]=> | |
bool(false) | |
["category_ids"]=> | |
array(0) { | |
} | |
["tag_ids"]=> | |
array(0) { | |
} | |
["shipping_class_id"]=> | |
int(0) | |
["downloads"]=> | |
array(0) { | |
} | |
["image_id"]=> | |
string(0) "" | |
["gallery_image_ids"]=> | |
array(0) { | |
} | |
["download_limit"]=> | |
int(-1) | |
["download_expiry"]=> | |
int(-1) | |
["rating_counts"]=> | |
array(0) { | |
} | |
["average_rating"]=> | |
int(0) | |
["review_count"]=> | |
int(0) | |
} | |
["data_store":protected]=> | |
object(WC_Data_Store)#3568 (4) { | |
["instance":"WC_Data_Store":private]=> | |
object(WC_Product_Data_Store_CPT)#3571 (5) { | |
["internal_meta_keys":protected]=> | |
array(42) { | |
[0]=> | |
string(11) "_visibility" | |
[1]=> | |
string(4) "_sku" | |
[2]=> | |
string(6) "_price" | |
[3]=> | |
string(14) "_regular_price" | |
[4]=> | |
string(11) "_sale_price" | |
[5]=> | |
string(22) "_sale_price_dates_from" | |
[6]=> | |
string(20) "_sale_price_dates_to" | |
[7]=> | |
string(11) "total_sales" | |
[8]=> | |
string(11) "_tax_status" | |
[9]=> | |
string(10) "_tax_class" | |
[10]=> | |
string(13) "_manage_stock" | |
[11]=> | |
string(6) "_stock" | |
[12]=> | |
string(13) "_stock_status" | |
[13]=> | |
string(11) "_backorders" | |
[14]=> | |
string(17) "_low_stock_amount" | |
[15]=> | |
string(18) "_sold_individually" | |
[16]=> | |
string(7) "_weight" | |
[17]=> | |
string(7) "_length" | |
[18]=> | |
string(6) "_width" | |
[19]=> | |
string(7) "_height" | |
[20]=> | |
string(11) "_upsell_ids" | |
[21]=> | |
string(14) "_crosssell_ids" | |
[22]=> | |
string(14) "_purchase_note" | |
[23]=> | |
string(19) "_default_attributes" | |
[24]=> | |
string(19) "_product_attributes" | |
[25]=> | |
string(8) "_virtual" | |
[26]=> | |
string(13) "_downloadable" | |
[27]=> | |
string(15) "_download_limit" | |
[28]=> | |
string(16) "_download_expiry" | |
[29]=> | |
string(9) "_featured" | |
[30]=> | |
string(19) "_downloadable_files" | |
[31]=> | |
string(16) "_wc_rating_count" | |
[32]=> | |
string(18) "_wc_average_rating" | |
[33]=> | |
string(16) "_wc_review_count" | |
[34]=> | |
string(22) "_variation_description" | |
[35]=> | |
string(13) "_thumbnail_id" | |
[36]=> | |
string(11) "_file_paths" | |
[37]=> | |
string(22) "_product_image_gallery" | |
[38]=> | |
string(16) "_product_version" | |
[39]=> | |
string(12) "_wp_old_slug" | |
[40]=> | |
string(10) "_edit_last" | |
[41]=> | |
string(10) "_edit_lock" | |
} | |
["extra_data_saved":protected]=> | |
bool(false) | |
["updated_props":protected]=> | |
array(0) { | |
} | |
["meta_type":protected]=> | |
string(4) "post" | |
["object_id_field_for_meta":protected]=> | |
string(0) "" | |
} | |
["stores":"WC_Data_Store":private]=> | |
array(20) { | |
["coupon"]=> | |
string(24) "WC_Coupon_Data_Store_CPT" | |
["customer"]=> | |
string(22) "WC_Customer_Data_Store" | |
["customer-download"]=> | |
string(31) "WC_Customer_Download_Data_Store" | |
["customer-download-log"]=> | |
string(35) "WC_Customer_Download_Log_Data_Store" | |
["customer-session"]=> | |
string(30) "WC_Customer_Data_Store_Session" | |
["order"]=> | |
string(23) "WC_Order_Data_Store_CPT" | |
["order-refund"]=> | |
string(30) "WC_Order_Refund_Data_Store_CPT" | |
["order-item"]=> | |
string(24) "WC_Order_Item_Data_Store" | |
["order-item-coupon"]=> | |
string(31) "WC_Order_Item_Coupon_Data_Store" | |
["order-item-fee"]=> | |
string(28) "WC_Order_Item_Fee_Data_Store" | |
["order-item-product"]=> | |
string(32) "WC_Order_Item_Product_Data_Store" | |
["order-item-shipping"]=> | |
string(33) "WC_Order_Item_Shipping_Data_Store" | |
["order-item-tax"]=> | |
string(28) "WC_Order_Item_Tax_Data_Store" | |
["payment-token"]=> | |
string(27) "WC_Payment_Token_Data_Store" | |
["product"]=> | |
string(25) "WC_Product_Data_Store_CPT" | |
["product-grouped"]=> | |
string(33) "WC_Product_Grouped_Data_Store_CPT" | |
["product-variable"]=> | |
string(34) "WC_Product_Variable_Data_Store_CPT" | |
["product-variation"]=> | |
string(35) "WC_Product_Variation_Data_Store_CPT" | |
["shipping-zone"]=> | |
string(27) "WC_Shipping_Zone_Data_Store" | |
["webhook"]=> | |
string(21) "WC_Webhook_Data_Store" | |
} | |
["current_class_name":"WC_Data_Store":private]=> | |
string(25) "WC_Product_Data_Store_CPT" | |
["object_type":"WC_Data_Store":private]=> | |
string(14) "product-simple" | |
} | |
["meta_data":protected]=> | |
NULL | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment