Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #4494041
Multi-line bundled products not showing correctly in blocks-based woocommerce cart
Open

Comments

  • Jorin started the conversation

    Using WPC Product Bundles 8.3.3

    When configuring the plugin setting on section "cart & checkout", named "Hide bundled products on cart & checkout page" to "Yes, but list bundled sub-product names under the main bundle in separate lines" all names still appear on the same line.

    After some testing it seems that only when using the classic Woocommerce cart this is shown correctly; when switching to the blocks-based Woocommerce cart it's all displayed on a single line.

  •  1,542
    Dustin replied

    Hi Jorin,

    Please add the custom code below to fix that issue. (How to add custom code? ↗):

    add_filter( 'woosb_order_bundled_product_name', function ( $name ) {
    	return '[' . $name . ']';
    } );
    
    add_action( 'wp_footer', function () {
    	?>
        <script type="text/javascript">
            (function ($) {
                $(function () {
                    // ready
                    var woosb = 0;
                    var woosbInterval = setInterval(function () {
                        woosb++;
    
                        if (woosb > 180) {
                            clearInterval(woosbInterval);
                        }
    
                        $('.wc-block-components-product-details__bundled-products:not(.woosb-initialized)').each(function () {
                            let $this = $(this);
                            let $meta = $this.find('.wc-block-components-product-details__value');
                            let bundled = $meta.text();
    
                            bundled = bundled.replace(/\[/gi, '<li>');
                            bundled = bundled.replace(/\]/gi, '</li>');
                            $meta.html('<ul>' + bundled + '</ul>');
    
                            $this.addClass('woosb-initialized');
                        });
                    }, 100);
                });
            })(jQuery);
        </script>
    	<?php
    }, 99 );

    Best regards,
    Dustin