Product title with variation number (shopping cart, checkout, order in backend)

This topic has 6 replies, 2 voices, and was last updated 1 months ago ago by Luca Rossi

  • Avatar: cmotal
    cmotal
    Participant
    August 28, 2024 at 12:09

    Hi there,

    we moved with our WooCommerce Shop to XStore theme from another older theme.

    After putting an article with a variation in the shopping cart, the old theme showed both “Article name” and “Variant” as headline for the shopping cart item. This combined title was also handed over in the order and all emails concerning the order.

    How can this behaviour set up in XStore?

    Please see screenshot in private content for details.

    Thanks,
    Christoph

    Please, contact administrator
    for this information.
    5 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    August 28, 2024 at 18:12

    Hi @cmotal,

    It’s not available in our XStore theme for now. You are welcome to submit a feature request on our request board at https://www.8theme.com/taskboard/. Should your suggestion garner sufficient support from other customers, our development team will take it into consideration for inclusion in future updates.

    The variation is still displaying under product title on cart & checkout pages:

    https://prnt.sc/jdTe4WyKlCdb
    https://prnt.sc/cYzxBkZngpnq

    Best Regards,
    8Theme’s Team

    Avatar: cmotal
    cmotal
    Participant
    August 28, 2024 at 19:49

    Hi Luca,

    thanks for getting back to me.

    Yes it’s right, that the variation is displayed, but the issue goes a little deeper in our case.

    If the order is placed, our payment provider takes the article name (WooCommerce default article name in the order position is: name + variation) from the order position and transfers it to his systems. So if we only got the article name without variation in the order position’s article name, we can not see the details (which variation was selected) at our payment provider’s reports and in the corresponding documents. Also, our customers do not see the purchased article + variation in their invoice (generated by our payment provider).

    Hope you understand that changing the default WooCommerce behaviour in your theme massively influences our backend process, and not least the payment process at our payment provider’s systems.

    I hope you can offer a workaround or give any hooks to change this behaviour.

    Thanks

    Christoph

    Avatar: Justin
    Luca Rossi
    Support staff
    August 29, 2024 at 05:18

    Dear @cmotal,

    Here are the available hooks you should add the custom codes to:

    
    woocommerce_order_item_name
    woocommerce_cart_item_name
    

    https://woocommerce.github.io/code-reference/files/woocommerce-templates-cart-cart.html#source-view.51
    https://woocommerce.github.io/code-reference/files/woocommerce-templates-checkout-form-pay.html#source-view.43

    Hope it helps!

    Avatar: cmotal
    cmotal
    Participant
    August 29, 2024 at 09:24

    Hi Luca,

    please see the working solution for my case. Maybe this could be a customizer setting in a future version of the theme.

    add_action('woocommerce_checkout_create_order_line_item', 'nc_customize_order_item_name', 10, 4);
    
    function nc_customize_order_item_name($item, $cart_item_key, $values, $order) {
        $product_name = $item->get_name();
      
        if ($values['variation_id']) {
            $variation = wc_get_product($values['variation_id']);
            $variation_name = wc_get_formatted_variation($variation, true);
            $new_name = $product_name . ' - ' . $variation_name;
    		
            $item->set_name($new_name);
        }
    }
    

    Christoph

    Avatar: Justin
    Luca Rossi
    Support staff
    August 29, 2024 at 09:36

    Dear @cmotal,

    Thank you so much for sharing the codes.

    We will forward to our development team also.

    Best Regards,
    8Theme’s Team

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

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

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