Get_item_data doesnt work anymore - by Royalty

This topic has 6 replies, 2 voices, and was last updated 6 years, 11 months ago ago by Rose Tyler

  • Avatar: Royalty
    Royalty
    Participant
    May 1, 2017 at 17:34

    Hello,
    in framework/woo.php you’ve got this code in line 1261:
    <?php echo $woocommerce->cart->get_item_data( $cart_item ); ?>
    But it seams that this is deprecated since woocommerce 3.0.x, it doesnt show anything anymore. Any idea how to get the cart item data would be really appreciated.

    5 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 5, 2017 at 12:58

    Hello,

    This function is working fine on our side.
    You can find wc deprecated functions list – https://github.com/woocommerce/woocommerce/blob/master/includes/wc-deprecated-functions.php
    Could you please clarify your problem with more details? Also, provide necessary accesses.

    Regards,
    Rose Tyler.

    Avatar: Royalty
    Royalty
    Participant
    May 5, 2017 at 14:23

    Maybe I missunderstood the function. I thought that this function outputs the product variation (p.e. “Size: Medium”). I am searching for a solution to achieve this. Since Woocommerce version 3.0.X, the variation isnt shown seperately anymore, it’s always combined with the product name like so: “Shirt – Medium”. Royal did not implement this behavior at all so there is no variation shown because Royal uses “$_product->get_title()” while woocommerce uses “$_product->get_name()”. But anyway I would like to re-seperate the variation from the product name, give it a seperate class and style it different…

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 5, 2017 at 16:04

    Hello,

    Where exactly you want to change it?
    Try to change etheme_cart_items function.
    We recommend to make changes in the child theme https://codex.wordpress.org/Child_Themes because you’ll lose all modifications after each theme update.

    Regards,
    Rose Tyler.

    Avatar: Royalty
    Royalty
    Participant
    May 5, 2017 at 16:48

    I’ll try to explain it more clearly:
    In your demoshop, your running older versions of Royal theme and woocommerce. The cart with a variable product looks like in this screenshot:
    http://fs5.directupload.net/images/170505/yo7mcfm4.jpg
    It shows the product name and the variation attributes (Color and Size).
    In Woocommerce 3.0, this has been changed. Now, they use $_product->get_name() instead of $_product->get_title() (version 2.9.X) and the variation attributes are combined with the product name like “FASHION ACCESSORIES – Red, Small”. But in Royal theme, the variation attributes are not shown at all because it uses the deprecated $_product->get_title() – this shows only the product title and the variation attributes have disappeared.
    My goal is to show the variation attributes again, but in the old style like on the screenshot above – not combined with the product name because I want to change their position and their look.
    Do you know what I mean?

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 8, 2017 at 12:59

    Hello,

    Unfortunately, it is not possible to show attributes in the old style, because it was changed by woocommerce, the same situation you can see with official WC theme – Storefront: title + variation.

    Regards,
    Rose Tyler.

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.