• Resolved emcubio

    (@emcubio)


    Hi, we have problem with updating price with tax and without tax, plugin is showing same value for both prices.

    On product page are same values for both prices – https://ctrlv.sk/Vp1h
    When we open CPO builder, prices are calculated correctly – https://ctrlv.sk/iwE3

    For displaying price we use functions get_price_including_tax() and get_price_excluding_tax()

    When i see Ajax response, there is value for both prices.

    {success: true, data: {,…}}
    data: {,…}
    all_options_data: []
    errors: []
    extra_data: {order_product: "enabled"}
    formatted_vars: {uni_cpo_width_x1: "2", uni_cpo_width_x1_count: 1, uni_cpo_width_x1_count_spaces: 1,…}
    nice_names_vars: {uni_cpo_price: "15"}
    price_vars: {quantity: 1, currency: "€", currency_code: "EUR", price: "15 €", raw_price: 15,…}
    currency: "€"
    currency_code: "EUR"
    price: "15 €"
    price_tax_suffix: ""
    quantity: 1
    raw_price: 15
    raw_price_tax_rev: 12.5
    raw_total: 15
    raw_total_tax_rev: 12.5
    total: "15 €"
    total_tax_rev: "13 €"
    total_tax_suffix: ""
    

    Is there any solution how to update price with right values also on public single product page? Thank you

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author moomooagency

    (@moomooagency)

    Hi,

    Could you describe how exactly you are using get_price_including_tax() and get_price_excluding_tax() functions for displaying prices?

    Also I see that you have the same classes for both price tags https://prnt.sc/1siy2te It means that when you trying to display the price you put in that tag .price-without-tax only price without tax.

    Thread Starter emcubio

    (@emcubio)

    Hi,

    thank you for reply.

    We using edited default Woo template price.php, where is global variable global $product;
    Then:

    <span class="price-right">
    	<div class="price-without-tax">
    		<p>
    			<span id="woo-price-wotax" class="<?php echo esc_attr( apply_filters( 'woocommerce_product_price_class', 'price' ) ); ?>"><?php echo woocommerce_price( $product->get_price_including_tax() ); ?> s DPH </span>
    		</p>
    	</div>
    	<div id="woo-price-withtax" class="price-with-tax">
    		<?php echo woocommerce_price( $product->get_price_excluding_tax() );?> bez DPH
    	</div>
    </span>

    We used filter to edit suffix for price with tax, we tested it without, also removed same classes and it still not works properly.

    Maybe we have wrong configured selectors in plugin?
    We use selector .price-wrapper bdi:first-child as Custom selector (id/class) for a product price html tag

    I found not if that selector should be for price with, tax, without tax or for selector for both prices. When i edited selector just for price with tax, just price with tax was calculated based on dimensions.

    Thank you.

    • This reply was modified 3 years, 2 months ago by emcubio.
    Plugin Author moomooagency

    (@moomooagency)

    Hi,

    1. You need to use this selector for price with tax: .price-with-tax .woocommerce-Price-amount.amount bdi
    2. Then you need to change this class https://prnt.sc/1sx77yd to .price-without-tax
    3. Then use js event https://moomoo-agency.gitbook.io/uni-cpo-4-documentation/for-developers/js-events “uni_cpo_options_data_ajax_success” and manually (i mean using js) update price in tag .price-without-tax .woocommerce-Price-amount.amount bdi

    Thread Starter emcubio

    (@emcubio)

    Thank you for help ??

    Final snippet looks like this. I didn’t find documentation for parameters to “uni_cpo_options_data_ajax_success” event. Maybe this helps to others with similiar problem. ??

    
    jQuery(document.body).on("uni_cpo_options_data_ajax_success", function(e, data, ajax_val){
    	$(".price-without-tax .woocommerce-Price-amount.amount bdi").html(ajax_val.price_vars.total_tax_rev);
    });
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Price without tax doesn’t update’ is closed to new replies.