php - WooCommerce - list cart item names outside of the product page -
I am trying to create a simple bulleted list of items which have already been added to the cart, which Later a gravity form field will be passed even so far I have come with:
I have added two items to the cart, and the result has been received:
- 747579165776fe1ba349237464ae0eed
- f06a642b52d91adfa0168b737bd60db9
However, I'm trying to get the title of products instead of the key.
You will need to:
& lt; Php global $ woocommerce; $ Items = $ woocommerce- & gt; Cart- & gt; Get_cart (); Forex Currency ($ item $ item = & gt; $ values) {? & Gt; By & lt;? // print_r ($ item); ? & Gt; By & lt;? $ _product = $ value ['data'] - & gt; Post; ? & Gt; By & lt;? Echo $ _product- & gt; Post_chirtle; ? & Gt; & Lt ;? Php}? & Gt;
You can use for any post value, post_title, post_date, id etc. // print_r ($ item) cancel; And see what I mean. Apart from this, you can change some fraction with other data: $ _product = $ value ['data'] -> post; For example, to access the product ID, do not have a post ID, make the changes inside the freechitch function:
$ _ product = $ value ['data']; Echo $ _product- & gt; Id;
Comments
Post a Comment