Problem switching currencies with Elementor mini cart
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from ezryk on November 24, 2020, 15:13I've created several products with dedicated prices for each currency. When I add a product to the cart and then I change the currency, I see the right price for the product in the new currency in the mini cart on the header menu, but the subtotal is left the same. Another weird thing is that the currency symbol of the subtotal does change, but the amount remains the same as the initial currency.
In this case the €170 is correct but the €155 is wrong. It was initially added in British pounds (GBP) as £155 but after conversion to Euro was left as the same amount, just with a different symbol.
The problem only occurs on the shop page and the products pages, it does not happen on the cart page.
I've created several products with dedicated prices for each currency. When I add a product to the cart and then I change the currency, I see the right price for the product in the new currency in the mini cart on the header menu, but the subtotal is left the same. Another weird thing is that the currency symbol of the subtotal does change, but the amount remains the same as the initial currency.

In this case the €170 is correct but the €155 is wrong. It was initially added in British pounds (GBP) as £155 but after conversion to Euro was left as the same amount, just with a different symbol.
The problem only occurs on the shop page and the products pages, it does not happen on the cart page.
Quote from Pablo Borysenco on November 25, 2020, 12:18Hello
it looks like an incompatibility with the cart template
find this file(I think is cart.php) in the current theme
To convert price - https://currency-switcher.com/function/woocs-woocs_exchange_value/
Hello
it looks like an incompatibility with the cart template
find this file(I think is cart.php) in the current theme
To convert price - https://currency-switcher.com/function/woocs-woocs_exchange_value/
Quote from ezryk on November 25, 2020, 14:29The theme doesn't have a cart.php file, it only uses functions and hooks to integrate with woocommerce.
Is there a different way to fix this? Preferably something that only requires changing the functions.php file of the child theme so that the changes won't be erased after updating the plugin.
The theme doesn't have a cart.php file, it only uses functions and hooks to integrate with woocommerce.
Is there a different way to fix this? Preferably something that only requires changing the functions.php file of the child theme so that the changes won't be erased after updating the plugin.
Quote from Pablo Borysenco on November 26, 2020, 10:55Hello
Is there a different way to fix this? - First, you need to find the code in which the cart template is formed
Hello
Is there a different way to fix this? - First, you need to find the code in which the cart template is formed
Quote from ezryk on November 26, 2020, 18:50OK, I found the template, but I don't understand from the documentation where in the code I need to implement the changes, and how to do it without breaking something. Please be more specific.
<?php
defined( 'ABSPATH' ) || exit;
if ( ! function_exists( 'elementor_pro_render_mini_cart_item' ) ) {
function elementor_pro_render_mini_cart_item( $cart_item_key, $cart_item ) {
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
$is_product_visible = ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key ) );if ( ! $is_product_visible ) {
return;
}$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
$product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
?>
<div class="elementor-menu-cart__product woocommerce-cart-form__cart-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>"><div class="elementor-menu-cart__product-image product-thumbnail">
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );if ( ! $product_permalink ) :
echo wp_kses_post( $thumbnail );
else :
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), wp_kses_post( $thumbnail ) );
endif;
?>
</div><div class="elementor-menu-cart__product-name product-name" data-title="<?php esc_attr_e( 'Product', 'elementor-pro' ); ?>">
<?php
if ( ! $product_permalink ) :
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . ' ' );
else :
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) );
endif;do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );
// Meta data.
echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok.
?>
</div><div class="elementor-menu-cart__product-price product-price" data-title="<?php esc_attr_e( 'Price', 'elementor-pro' ); ?>">
<?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s × %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key ); ?>
</div><div class="elementor-menu-cart__product-remove product-remove">
<?php
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
'<a href="%s" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s"></a>',
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
__( 'Remove this item', 'elementor-pro' ),
esc_attr( $product_id ),
esc_attr( $cart_item_key ),
esc_attr( $_product->get_sku() )
), $cart_item_key );
?>
</div>
</div>
<?php
}
}$cart_items = WC()->cart->get_cart();
if ( empty( $cart_items ) ) { ?>
<div class="woocommerce-mini-cart__empty-message"><?php esc_attr_e( 'No products in the cart.', 'elementor-pro' ); ?></div>
<?php } else { ?>
<div class="elementor-menu-cart__products woocommerce-mini-cart cart woocommerce-cart-form__contents">
<?php
do_action( 'woocommerce_before_mini_cart_contents' );foreach ( $cart_items as $cart_item_key => $cart_item ) {
elementor_pro_render_mini_cart_item( $cart_item_key, $cart_item );
}do_action( 'woocommerce_mini_cart_contents' );
?>
</div><div class="elementor-menu-cart__subtotal">
<strong><?php echo __( 'Subtotal', 'woocommerce' ); // phpcs:ignore WordPress.WP.I18n ?>:</strong> <?php echo WC()->cart->get_cart_subtotal(); ?>
</div>
<div class="elementor-menu-cart__footer-buttons">
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class="elementor-button elementor-button--view-cart elementor-size-md">
<span class="elementor-button-text"><?php echo __( 'View cart', 'woocommerce' ); // phpcs:ignore WordPress.WP.I18n ?></span>
</a>
<a href="<?php echo esc_url( wc_get_checkout_url() ); ?>" class="elementor-button elementor-button--checkout elementor-size-md">
<span class="elementor-button-text"><?php echo __( 'Checkout', 'woocommerce' ); // phpcs:ignore WordPress.WP.I18n ?></span>
</a>
</div>
<?php
} // empty( $cart_items )?>
OK, I found the template, but I don't understand from the documentation where in the code I need to implement the changes, and how to do it without breaking something. Please be more specific.
<?php
defined( 'ABSPATH' ) || exit;
if ( ! function_exists( 'elementor_pro_render_mini_cart_item' ) ) {
function elementor_pro_render_mini_cart_item( $cart_item_key, $cart_item ) {
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
$is_product_visible = ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key ) );
if ( ! $is_product_visible ) {
return;
}
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
$product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
?>
<div class="elementor-menu-cart__product woocommerce-cart-form__cart-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
<div class="elementor-menu-cart__product-image product-thumbnail">
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
if ( ! $product_permalink ) :
echo wp_kses_post( $thumbnail );
else :
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), wp_kses_post( $thumbnail ) );
endif;
?>
</div>
<div class="elementor-menu-cart__product-name product-name" data-title="<?php esc_attr_e( 'Product', 'elementor-pro' ); ?>">
<?php
if ( ! $product_permalink ) :
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . ' ' );
else :
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) );
endif;
do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );
// Meta data.
echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok.
?>
</div>
<div class="elementor-menu-cart__product-price product-price" data-title="<?php esc_attr_e( 'Price', 'elementor-pro' ); ?>">
<?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s × %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key ); ?>
</div>
<div class="elementor-menu-cart__product-remove product-remove">
<?php
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
'<a href="%s" aria-label="%s" data-product_id="%s" data-cart_item_key="%s" data-product_sku="%s"></a>',
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
__( 'Remove this item', 'elementor-pro' ),
esc_attr( $product_id ),
esc_attr( $cart_item_key ),
esc_attr( $_product->get_sku() )
), $cart_item_key );
?>
</div>
</div>
<?php
}
}
$cart_items = WC()->cart->get_cart();
if ( empty( $cart_items ) ) { ?>
<div class="woocommerce-mini-cart__empty-message"><?php esc_attr_e( 'No products in the cart.', 'elementor-pro' ); ?></div>
<?php } else { ?>
<div class="elementor-menu-cart__products woocommerce-mini-cart cart woocommerce-cart-form__contents">
<?php
do_action( 'woocommerce_before_mini_cart_contents' );
foreach ( $cart_items as $cart_item_key => $cart_item ) {
elementor_pro_render_mini_cart_item( $cart_item_key, $cart_item );
}
do_action( 'woocommerce_mini_cart_contents' );
?>
</div>
<div class="elementor-menu-cart__subtotal">
<strong><?php echo __( 'Subtotal', 'woocommerce' ); // phpcs:ignore WordPress.WP.I18n ?>:</strong> <?php echo WC()->cart->get_cart_subtotal(); ?>
</div>
<div class="elementor-menu-cart__footer-buttons">
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class="elementor-button elementor-button--view-cart elementor-size-md">
<span class="elementor-button-text"><?php echo __( 'View cart', 'woocommerce' ); // phpcs:ignore WordPress.WP.I18n ?></span>
</a>
<a href="<?php echo esc_url( wc_get_checkout_url() ); ?>" class="elementor-button elementor-button--checkout elementor-size-md">
<span class="elementor-button-text"><?php echo __( 'Checkout', 'woocommerce' ); // phpcs:ignore WordPress.WP.I18n ?></span>
</a>
</div>
<?php
} // empty( $cart_items )
?>
Quote from Pablo Borysenco on November 27, 2020, 12:44Hello
if you have no experience in programming you should hire a developer
you need to convert it - https://c2n.me/49ZPbgi.png
To get subtotal:
$subtotal= WC()->cart->get_subtotal() global $WOOCS; $res=$WOOCS->woocs_exchange_value($subtotal); To show subtotal echo wc_price($res);
Hello
if you have no experience in programming you should hire a developer
you need to convert it - https://c2n.me/49ZPbgi.png
To get subtotal:
$subtotal= WC()->cart->get_subtotal() global $WOOCS; $res=$WOOCS->woocs_exchange_value($subtotal); To show subtotal echo wc_price($res);