تخطي الملاحة

Open

Reported for: WooCommerce Multilingual & Multicurrency 5.3.8

Topic Tags: Bug, Compatibility, WCML

Overview of the issue

When using WooCommerce Bookings with a multi-currency setup and configuring currencies to change based on selected countries (without a visible currency switcher), the prices do not adjust according to the selected country during the checkout process. While the currency symbol changes, the actual price remains fixed, causing discrepancies in the displayed amounts.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open your theme’s functions.php file.
  • Add the following snippet:
    add_filter( 'woocommerce_checkout_update_order_review', function() {
    		$cartItems = WC()->cart->get_cart();
    
    		if ( is_array( $cartItems ) ) {
    			foreach ( $cartItems as &$cartItem ) {
    				if ( isset( $cartItem['booking'] ) && isset( $cartItem['data'] ) ) {
    					$product                = $cartItem['data'];
    					$product->check_in_cart = false;
    					$calculatedCost         = WC_Bookings_Cost_Calculation::calculate_booking_cost( $cartItem['booking'], $product );
    
    					$cartItem['booking']['_cost'] = $calculatedCost;
    					$cartItem['data']->set_price( $calculatedCost );
    				}
    			}
    		}
    	} );
    

ترك رد

يُرجى البقاء في الموضوع والتزام الاحترام للآخرين. إذا كنت بحاجة إلى مساعدة بشأن المشكلات التي لا تتعلق بهذا المنشور، فاستخدم منتدى الدعم لبدء محادثة أو إرسال تذكرة.

يمكنك استخدام هذه العلامات:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>