Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Dummy method to suppress the "unsupported product" warning. This method
- * leaves the product untouched, without performing any conversion.
- *
- * @param WC_Product product A product instance.
- * @param string currency The target currency.
- * @return WC_Product
- * @author Aelia <support@aelia.co>
- * @link https://aelia.co
- */
- function aelia_skip_product_conversion($product, $currency) {
- return $product;
- }
- /**
- * Replace the conversion callback with a custom one for specific product types.
- *
- * Need help customising the code for your need? Hire us on Codeable: http://bit.ly/codeable_aelia
- *
- * @param callable convert_callback A callback function, or method.
- * @param WC_Product product A product.
- * @return callable A callback function, or method.
- * @author Aelia <support@aelia.co>
- * @link https://aelia.co
- */
- add_filter('wc_aelia_currencyswitcher_product_convert_callback', function($convert_callback, $product) {
- // Skip conversion for products with type "accommodation-booking"
- if($product->product_type === 'accommodation-booking') {
- $convert_callback = 'aelia_skip_product_conversion';
- }
- return $convert_callback;
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement