• Hi,
    For accountability reasons I need to display prices per component in my back-office and on invoices.
    Currently, only the total price for the composite product is displayed, and the prices for components are set to 0. Is there a way to configure it as described above?
    Thank you in advance for your reply!

    • This topic was modified 2 years, 6 months ago by monintimite.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author WPClever

    (@wpclever)

    Hi @monintimite

    Seem you set “Only base price” for the composite products https://www.screencast.com/t/McZu3vLw, right?

    For the order/invoice detail, please add below snippet (How to add custom code?):

    add_filter( 'woocommerce_order_formatted_line_subtotal', 'wooco_component_order_subtotal', 99, 2 );
    function wooco_component_order_subtotal( $subtotal, $item ) {
    	if ( $item->get_meta( 'wooco_parent_id' ) ) {
    		$_product = wc_get_product( $item->get_variation_id() ?: $item->get_product_id() );
    
    		if ( $_product ) {
    			return wc_price( $_product->get_price() * $item->get_quantity() );
    		}
    	}
    
    	return $subtotal;
    }

    We shouldn’t change the total in the back office to prevent duplicate total and wrong reports.

    Thread Starter monintimite

    (@monintimite)

    Hi,
    Thank you for your timely reply! Indeed, I had selected “only base price” option when configuring my composite products.
    I added the filter in the theme functions page. However, the backoffice still displays zero for the components 🙁

    Getting back to your comment on the selection of “only base price”. If I change this option to another, can it solve my problem in the back office?

    Thank you in advance for your support and have a wonderful day!

    • This reply was modified 2 years, 6 months ago by monintimite.
    Plugin Author WPClever

    (@wpclever)

    As I mentioned above, the snippet only affects order confirmation (on thank you page) and the invoice to the customer. It doesn’t change the total on order detail in the back office (wp-admin).

    In case, you choose to include or exclude the base price, the total will be calculated from component products and the price of component products will be shown (not as zero).

    I have the same problem but only with mails. In the backend I see the prices from every component, but in email confirmation for customer zhe prices for the single components are not visible. I need this because the basic price in my case is 0 Euro and the components price will add to the basic price. Everything is working only the mail confirmation for customer show the basic price 0 and then waht is included (components) but not the single prices for the components.

    Is there a snippet possible to fix that?

    5 month ago I got a snippet and this works: Since some days I have no price in my mails from the single components. I use the premium version.

    add_filter( 'haet_mail_placeholder_menu_products_table', 'wpc_price_selector', 99 );
    function wpc_price_selector( $arr ) {
    	$arr[] = array(
    		'text'    => __( 'WPC Price', 'haet_mail' ),
    		'tooltip' => '[WPC_PRICE]',
    	);
    
    	return $arr;
    }
    
    add_filter( 'haet_mail_order_placeholders_products_table', 'wpc_price_content', 99, 3 );
    function wpc_price_content( $item_data, $item, $_product ) {
    	if( isset($item['wooco_parent_id']) ) {
    		$item_data['wpc_price'] = '<span style="opacity: 0.3">'. $item_data['price'] .'</span>';
    	} else {
    		$item_data['wpc_price'] = $item_data['price'];
    	}
    
    	return $item_data;
    }
    • This reply was modified 2 years, 6 months ago by kaschwei.
    Plugin Support miemie

    (@miemie)

    Hi @kaschwei,

    If you are using premium version of our plugin, pls kindly submit a ticket to our support page to request for helping because this forum mainly supports for our free version plugin.

    Regards,

    Thread Starter monintimite

    (@monintimite)

    Hi @wpclever,
    Finally, I cannot use the snippet you shared because it screws up my checkout page (the code is displayed on the top of the page)
    I tried to change the option from “Only base price” to “Exclude base price” but the total amount displayed on the product page is 1 cent less then the expected price :(.
    So, the problem is not fixed yet 🙁

    1 cent less then the expected price :(.

    That can be a rounding problem in Wooocommerce. If you only enter two digits when rounding down, this can happen. Usually there is also a rounding to four places after the decimal point.

    Plugin Support miemie

    (@miemie)

    Hi @monintimite,

    Can you pls kindly provide us screenshots of the issue in the front-end, settings in the back-end and the product link to check and give you a proper solution?

    Regards,

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Displaying prices per component on invoices’ is closed to new replies.