SZ4H
Forum Replies Created
-
I found an issue in your plugin
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price_mstore_api' ); function add_custom_price_mstore_api( $cart_object ) { foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { $add_price = 0; if ($variations = $cart_item['variation']) { foreach($variations as $v => $f) { preg_match('#\((.*?)\)#', $v, $match); if(is_array($match) && array_key_exists(1,$match)){ $val = $match[1]; $cents = filter_var($val, FILTER_SANITIZE_NUMBER_INT); if(is_numeric($cents)){ $add_price += floatval($cents / 100); } } } } $new_price = $cart_item['data']->get_price() + $add_price; $res = $cart_item['data']->set_price($new_price); } }The above code contains
$new_price = $cart_item['data']->get_price() + $add_price; $res = $cart_item['data']->set_price($new_price);First nonsense issue it’s outside if condition which only get the price and add 0 to it
Second once get the price with WOOCS I guess it give the price in current currency conversion not the base price So once set price again it reconvert the price againSo an example of what happened:
if I have 2 currencies KWD (default) and USD and the conversion rate is 2 for example
With a product with 100 KWD price added to cart in EUR website version
The cart should contains $200 product. But it shows $400 product in the cartPlease advise why this method exists in a first place and does it needed on mobile?
- This reply was modified 3 years, 10 months ago by SZ4H.
Also this is the code I replaced into states-cities-places-for-woocommerce.php
Line 221foreach ( $dropdown_places as $city_key => $city_name ) { if(!is_array($city_name)) { if (is_numeric($city_key)) $field .= '<option value="' . esc_attr( $city_name ) . '" '.selected( $value, $city_name, false ) . '>' . $city_name .'</option>'; else $field .= '<option value="' . esc_attr( $city_key ) . '" '.selected( $value, $city_name, false ) . '>' . $city_name .'</option>'; } }BTW REGEXP I use is
Search for
_x\(‘(.*)’, ‘(.*)’,
Replace with
‘$1’ => _x(‘$1’, ‘$2’,
And then Search for
_x\(‘(.*)’,
Replace with
‘$1’ => _x(‘$1’,Forum: Plugins
In reply to: [YOP Poll] Can't create poll after upgrade to proI have fixed by clear hosting cache
as I use siteground which have a cache module in cpanelThanks anyway
Forum: Plugins
In reply to: [Video Thumbnails] Video thumbnail grabbed but Featured image not updatedany update on this please?
Forum: Hacks
In reply to: Media Uploader Default ViewI deleted the wptouch plugin and installed one responsive theme with mobile theme switcher
thanks
Forum: Themes and Templates
In reply to: Problem with using paging for custom post typeThanks I solved it
the problem was not in query or the paging but I used category-9.php template page
but I fixed it by using archive-videos.phpThanks