- This topic has 8 replies, 2 voices, and was last updated 2 years, 12 months ago by
Tom.
-
AuthorPosts
-
January 31, 2020 at 8:47 am #1150571
Taylor
On my site when a variation is added to the cart the variations are shown by the slug value not the name which makes it difficult to identify which product was added to the cart. Can this value be changed from the slug to the value.
Thanks
January 31, 2020 at 4:47 pm #1150911Tom
Lead DeveloperLead DeveloperHi there,
I did some looking around and found this: https://stackoverflow.com/questions/39045038/woocommerce-display-product-variation-description-on-cart-page
Let me know if it helps or not 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJanuary 31, 2020 at 5:09 pm #1150926Taylor
Yeah that isn’t really the issue. The issue is this the product shows the title field and then below you get a variation label and slug i.e Diameter: 1-1-2. This should look like Diameter: 1-1/2. The issue is simply the cart is displaying attribute_pa field instead of the name field. So somewhere in the theme whatever field it is displaying needs to be changed to name instead of slug
February 1, 2020 at 9:31 am #1151436Tom
Lead DeveloperLead DeveloperHi there,
WooCommerce itself handles this in their templates.
Here’s the line that outputs it: https://github.com/woocommerce/woocommerce/blob/master/templates/cart/cart-item-data.php#L24
It looks like it’s looking for this value:
$item_data['display']
If we go look for $item_data, we find this: https://github.com/woocommerce/woocommerce/blob/master/includes/wc-template-functions.php#L3578
So it looks like it’s looking for a “Display” field, if that doesn’t exist, it will output the “value” field (which is likely what’s happening for you).
Do the variation have a name/display field set?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 1, 2020 at 9:48 am #1151465Taylor
Yea I do have a name field in each one. What’s confusing is that when you look at the attributes displayed in the table in additional information it is displaying the name field their but in the cart it pulls the slug.
February 1, 2020 at 4:32 pm #1151714Tom
Lead DeveloperLead DeveloperHmm, it might be a question for WooCommerce support.
Are you using a custom template for your product page to display the data like that? If so, can you share the template using something like pastebin or a github gist?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 1, 2020 at 4:34 pm #1151719Taylor
I am actually only using the generate press theme and premium plugin.
February 1, 2020 at 4:34 pm #1151720Taylor
I have submitted this to woocommerce support.
February 1, 2020 at 4:47 pm #1151737Tom
Lead DeveloperLead DeveloperLet me know what they say – it might be something simple I can help with 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.