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

Okay
  Public Ticket #4502221
Composite product price adds normal price + bundled product
Open

Comments

  • Philippe Ravix started the conversation

    Hello,

    In the last fw weeks (month ?) The composite price of a product is increased by the child products into it. Therefore customers see a price (almost double what it should be). 

    When looking the issue I get a 

    Uncaught TypeError: Cannot read properties of undefined (reading 'bind') inside the module code.


    What can be wrong ? 

  • Philippe Ravix replied

    I will try to be more specific

    The price visible on the product composite price is fine. It stays at the right amount throughout the product selection process(in the pack).

    BUT, after it is added into the basket, the products price in the baskets is the sum of the composite product + the elements that should be included in the package price.

    I am sending you screenshots of the issue.

    I have check conflict and can pinpoint to another module : WholesaleX from  Wholesale Team. Deactivating that extension fixes it. but I need both. Should I check with them as well ?

    Attached files:  Composite product issue.pdf

  •  1,542
    Dustin replied

    Hi Phlippe,

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

    add_action( 'woocommerce_before_calculate_totals', function ( $cart_object ) {
    	if ( ! defined( 'DOING_AJAX' ) && is_admin() ) {
    		// This is necessary for WC 3.0+
    		return;
    	}
    
    	$cart_contents = $cart_object->cart_contents;
    
    	foreach ( $cart_contents as $cart_item_key => $cart_item ) {
    		if ( ! empty( $cart_item['wooco_parent_id'] ) && is_a( $cart_item['data'], 'WC_Product' ) ) {
    			$cart_item['data']->add_meta_data( 'wholesalex_ignore', true );
    		}
    	}
    }, 99999 );
    
    add_filter( 'wholesalex_ignore_dynamic_price', function ( $ignore, $product ) {
    	if ( is_a( $product, 'WC_Product' ) && $product->get_meta( 'wholesalex_ignore' ) ) {
    		return true;
    	}
    
    	return $ignore;
    }, 99999, 2 );

    If the issue persists, please provide your website credentials (wp-admin link, username, and password) or create a development or staging site with identical configurations so that I can investigate further.

    Best regards,
    Dustin