wordpress - WooCommerce One Page Checkout does not display attributes or variations -
wordpress > woocommerce > 1 page checkout
on single product 1 page checkout enabled, have 3 variations of attribute:
when variation selected , added order, 1 page checkout displays product name, not include variation:
the variations displayed in full shopping cart, not when using 1 page. when customer ordering multiple variations, may confusing them.
i'd display variation customer has chosen alongside product name using 1 page checkout.
can help?
ps: apologize if incorrect place post. i'm new community, have taken 1 class in php , css, , have scoured google , stack answer. hoping can help. thank in advance! :)
in woocommerce 2.x, variation attributes displayed in cart meta data, in woocommerce 3.x included in product name. requires change cart customization in plugin or theme use new wc_product
method get_name()
instead of get_title()
.
if third party plugin or theme, ideally should find out if new version available compatible woocommerce 3.x , addresses issue. workaround, assuming plugin/theme uses filter hook woocommerce_cart_item_name
, can add following theme's functions.php
(if using third party theme, should create child theme don't lose changes on updating it):
add_filter( 'woocommerce_cart_item_name', function($name, $cart_item, $cart_item_key) { $product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); if (method_exists($product, 'get_name')) { // woocommerce 3.x $is_link = substr($name, 0, 3) === '<a '; $name = $product->get_name(); if ($is_link) { $name = sprintf( '<a href="%s">%s</a>', esc_url($product->get_permalink($cart_item)), $name ); } } return $name; }, 50, 3 );
wiki
Comments
Post a Comment