[Support request] Woocommerce Variation Showing Slug Value in Cart

Home Forums Support [Support request] Woocommerce Variation Showing Slug Value in Cart

Home Forums Support Woocommerce Variation Showing Slug Value in Cart

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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

    #1150911
    Tom
    Lead Developer
    Lead Developer

    Hi 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 🙂

    #1150926
    Taylor

    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

    #1151436
    Tom
    Lead Developer
    Lead Developer

    Hi 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?

    #1151465
    Taylor

    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.

    #1151714
    Tom
    Lead Developer
    Lead Developer

    Hmm, 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?

    #1151719
    Taylor

    I am actually only using the generate press theme and premium plugin.

    #1151720
    Taylor

    I have submitted this to woocommerce support.

    #1151737
    Tom
    Lead Developer
    Lead Developer

    Let me know what they say – it might be something simple I can help with 🙂

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.