FOX - Professionnel du commutateur de devises WooCommerce

Réservation facile WooCommerce (par @_Ashanna)

Lien du plug-in : WooCommerce Réservation facile

Le code est tiré d'ici : https://herownsweetcode.com/easy-booking/documentation/easy-booking/compatibility-with-other-plugins/woocommerce-currency-switcher/


Ajoutez le code suivant à votre thème functions.php (Easy Booking 2.0.9 ou supérieur) :

add_filter( 'easy_booking_two_dates_price', 'currency_switcher_new_price', 2, 1 ); function currency_switcher_new_price( $booking_price ) { if ( class_exists('WOOCS') ) { global $WOOCS; $currencies = $WOOCS->get_currencies(); $booking_price = $WOOCS->back_convert( $booking_price, $currencies[$WOOCS->current_currency]['rate'] ); } renvoie $prix_réservation ; } add_filter( 'easy_booking_one_date_price', 'currency_switcher_new_price', 2, 1 ); function currency_switcher_new_price( $booking_price ) { if ( class_exists('WOOCS') ) { global $WOOCS; $currencies = $WOOCS->get_currencies(); $booking_price = $WOOCS->back_convert( $booking_price, $currencies[$WOOCS->current_currency]['rate'] ); } renvoie $prix_réservation ; }

 


Ajoutez le code suivant à votre thème functions.php (Easy Booking 2.0.6 ou inférieur) :

add_filter( 'easy_booking_get_new_item_price', 'currency_switcher_new_price', 2, 4 ); function currency_switcher_new_price( $booking_price, $product, $_product, $duration ) { if ( class_exists('WOOCS') ) { global $WOOCS; $currencies = $WOOCS->get_currencies(); $booking_price = $WOOCS->back_convert( $booking_price, $currencies[$WOOCS->current_currency]['rate'] ); } renvoie $prix_réservation ; } add_filter( 'easy_booking_fragments', 'currency_switcher_price_fragment', 10, 1 ); function currency_switcher_price_fragment( $fragments ) { if ( isset( $fragments['booking_price'] ) && class_exists('WOOCS') ) { global $WOOCS; $currencies = $WOOCS->get_currencies(); $fragments['booking_price'] = $fragments['booking_price'] * $currencies[$WOOCS->current_currency]['rate'] ; } renvoie $fragments ; }