/** * Plugin Name: Custom WooCommerce Currency Switcher * Description: A floating currency switcher for WooCommerce with a pop-up selector. * Version: 1.2 * Author: Your Name * License: GPL2 */ // Enqueue CSS and JavaScript function custom_currency_switcher_assets() { wp_enqueue_style('currency-switcher-css', plugin_dir_url(__FILE__) . 'css/currency-switcher.css'); wp_enqueue_script('jquery'); wp_enqueue_script('currency-switcher-js', plugin_dir_url(__FILE__) . 'js/currency-switcher.js', array('jquery'), null, true); wp_localize_script('currency-switcher-js', 'currencySwitcherAjax', array( 'ajax_url' => admin_url('admin-ajax.php'), )); } add_action('wp_enqueue_scripts', 'custom_currency_switcher_assets'); // Ensure WooCommerce session starts properly function start_woocommerce_session() { if (!session_id()) { session_start(); } if (WC()->session) { WC()->session->set('currency', WC()->session->get('currency', 'USD')); } } add_action('init', 'start_woocommerce_session'); // Currency symbols mapping function get_currency_symbols() { return array( 'USD' => '$', 'NGN' => '₦', 'GHS' => '₵', 'ZAR' => 'R' ); } // Add currency switcher HTML (Removed from checkout page) // Add currency switcher only on specific pages function custom_currency_switcher_html() { if (is_checkout() || is_shop()) { return; // Don't show on checkout or shop page } // Check if we're on a single product page and if the product belongs to the "recipe-book" category if (is_product()) { global $post; $product = wc_get_product($post->ID); if (!$product || !has_term('recipe-book', 'product_cat', $product->get_id())) { return; // Hide switcher if not in the "recipe-book" category } } // Ensure it shows on the cart page if (is_cart() || is_product()) { $selected_currency = WC()->session->get('currency', 'USD'); $currencies = array('USD' => 'USD', 'NGN' => 'NGN', 'GHS' => 'GHS', 'ZAR' => 'ZAR'); echo '
'; echo '
Currency: ' . esc_html($selected_currency) . '
'; echo '
'; // Currency Popup echo '
'; echo ''; echo ''; echo '
'; } } add_action('wp_footer', 'custom_currency_switcher_html'); // Handle AJAX currency switching function set_currency() { if (!WC()->session) { WC()->initialize_session(); } if (isset($_POST['currency'])) { $currency = sanitize_text_field($_POST['currency']); WC()->session->set('currency', $currency); // Ensure prices update dynamically via AJAX WC()->cart->calculate_totals(); wp_send_json_success(array('currency' => $currency)); } else { wp_send_json_error(array('message' => 'Invalid request')); } wp_die(); } add_action('wp_ajax_set_currency', 'set_currency'); add_action('wp_ajax_nopriv_set_currency', 'set_currency'); // Display correct price and currency symbol function custom_currency_display_price($price, $product) { if (!WC()->session) { WC()->initialize_session(); } $selected_currency = WC()->session->get('currency', 'USD'); $currency_symbols = get_currency_symbols(); $custom_price = get_post_meta($product->get_id(), '_custom_price_' . strtolower($selected_currency), true); if (!empty($custom_price)) { $symbol = isset($currency_symbols[$selected_currency]) ? $currency_symbols[$selected_currency] : $selected_currency; return $symbol . number_format($custom_price, 2); } return $price; } add_filter('woocommerce_get_price_html', 'custom_currency_display_price', 10, 2); // Update Cart & Checkout Prices Based on Selected Currency function update_cart_totals($cart) { if (!WC()->session) { return; } $selected_currency = WC()->session->get('currency', 'USD'); $currency_symbols = get_currency_symbols(); foreach ($cart->get_cart() as $cart_item) { $product = wc_get_product($cart_item['product_id']); $custom_price = get_post_meta($product->get_id(), '_custom_price_' . strtolower($selected_currency), true); if (!empty($custom_price)) { $cart_item['data']->set_price($custom_price); } } } add_action('woocommerce_before_calculate_totals', 'update_cart_totals', 10, 1); // Ensure Checkout Uses Selected Currency and Symbol function set_currency_at_checkout($currency) { if (WC()->session) { return WC()->session->get('currency', 'USD'); } return $currency; } add_filter('woocommerce_currency', 'set_currency_at_checkout'); // Add AJAX refresh for cart page when switching currency function refresh_cart_on_currency_change() { wc_add_notice(__('Currency updated successfully.', 'woocommerce'), 'success'); wp_send_json_success(); } add_action('wp_ajax_refresh_cart', 'refresh_cart_on_currency_change'); add_action('wp_ajax_nopriv_refresh_cart', 'refresh_cart_on_currency_change'); // Add custom price fields for different currencies in the product edit page function add_custom_currency_fields() { global $post; echo '
'; $currencies = array( 'USD' => 'US Dollar', 'NGN' => 'Nigerian Naira', 'GHS' => 'Ghanaian Cedi', 'ZAR' => 'South African Rand' ); foreach ($currencies as $currency_code => $currency_label) { woocommerce_wp_text_input(array( 'id' => '_custom_price_' . strtolower($currency_code), 'label' => __('Price in ' . $currency_label, 'woocommerce'), 'desc_tip' => 'true', 'description' => __('Set a fixed price for ' . $currency_label . '.', 'woocommerce'), 'type' => 'number', 'custom_attributes' => array( 'step' => '0.01', 'min' => '0' ), )); } echo '
'; } add_action('woocommerce_product_options_pricing', 'add_custom_currency_fields'); // Save the custom prices function save_custom_currency_fields($post_id) { $currencies = array('USD', 'NGN', 'GHS', 'ZAR'); foreach ($currencies as $currency) { $field_id = '_custom_price_' . strtolower($currency); if (isset($_POST[$field_id])) { update_post_meta($post_id, $field_id, sanitize_text_field($_POST[$field_id])); } } } add_action('woocommerce_process_product_meta', 'save_custom_currency_fields'); // Handle AJAX request to fetch product price based on selected currency function get_product_price_by_currency() { if (!isset($_POST['product_id']) || !isset($_POST['currency'])) { wp_send_json_error(array('message' => 'Invalid request.')); } // Get the product ID and selected currency $product_id = intval($_POST['product_id']); $currency = sanitize_text_field($_POST['currency']); // Ensure WooCommerce session is initialized if (!WC()->session) { WC()->initialize_session(); } // Define your currency symbols mapping (you can modify it) $currency_symbols = array( 'USD' => '$', 'NGN' => '₦', 'GHS' => '₵', 'ZAR' => 'R', ); // Get the custom price for the selected currency $custom_price = get_post_meta($product_id, '_custom_price_' . strtolower($currency), true); // If custom price is not set, use the regular price if (empty($custom_price)) { $product = wc_get_product($product_id); $custom_price = $product->get_price(); } // Get the correct currency symbol $currency_symbol = isset($currency_symbols[$currency]) ? $currency_symbols[$currency] : '$'; // Return the formatted price wp_send_json_success(array( 'price' => $currency_symbol . number_format($custom_price, 2), )); } add_action('wp_ajax_get_product_price', 'get_product_price_by_currency'); add_action('wp_ajax_nopriv_get_product_price', 'get_product_price_by_currency'); Vegetable Egg Sauce – Joyful-cook Skip to main content

Vegetable Egg Sauce

Vegetable Egg Sauce is a quick and easy dish that’s bursting with flavor and nutrition. It’s perfect for a busy weekday or a weekend brunch with the family. The eggs provide a hearty base, while the colorful veggies add texture, sweetness, and vitamins to each bite. Whether served with bread, rice, or on its own, this dish will soon become a go-to meal in your kitchen!

Vegetable Egg Sauce

Vegetable Egg Sauce: A Flavorful, Hearty Breakfast Delight

Looking for a quick, nutritious, and flavorful meal that will energize you for the day? This Vegetable Egg Sauce is a perfect choice! It combines the richness of eggs with vibrant mixed vegetables, creating a savory dish that’s perfect for breakfast, brunch, or even a light dinner. Serve it with your favorite bread or a refreshing drink, and you’re in for a treat!


What You’ll Need

Main Ingredients:

  • Eggs: The star of the dish, providing protein and richness. You’ll need four eggs to create a fluffy and creamy base for the vegetable sauce.
  • Mixed veggies (bell peppers, onions, tomatoes, spinach): Fresh, colorful vegetables bring both texture and nutrients to the dish.
  • Onion: For a savory base, diced onions are sautéed with garlic to add depth to the flavor.
  • Garlic: Minced garlic will enhance the aroma and infuse the dish with a delightful fragrance.
  • Curry powder & thyme: These spices add warmth and earthiness, giving the sauce a comforting, aromatic flavor.
  • Salt & pepper: To season the dish and bring out the natural flavors of the vegetables and eggs.
  • Vegetable oil: Used for sautéing the vegetables and eggs, ensuring they cook evenly and develop a rich flavor.
  • Bread: Choose your favorite bread—whether it’s a soft white loaf, whole wheat, or even a crusty baguette—to serve alongside the sauce.
  • Orange juice or tea bags: A refreshing drink on the side, offering a light, citrusy balance to the savory dish.

How to Make Vegetable Egg Sauce

Step 1: Prepare the Eggs

Crack the eggs into a bowl and beat them thoroughly until the yolks and whites are fully combined. Set aside.

Step 2: Sauté the Aromatics

Heat 2 tablespoons of vegetable oil in a skillet over medium heat.
Add the minced garlic and diced onions to the pan, and sauté until the garlic becomes fragrant and the onions turn translucent—about 2 minutes.

Step 3: Cook the Mixed Veggies

Add the finely chopped mixed vegetables (bell peppers, tomatoes, spinach) to the skillet.
Cook for a few minutes until the veggies soften slightly but still retain their color and texture. Stir occasionally.

Step 4: Season the Vegetables

Sprinkle in 1 teaspoon of curry powder and 1 teaspoon of thyme.
Season with salt and pepper to taste. Stir well to ensure the spices coat the veggies evenly.

Step 5: Add the Eggs

Pour the beaten eggs into the skillet with the sautéed vegetables.
Let the eggs cook untouched for about 1-2 minutes, allowing the edges to set.

Step 6: Scramble the Eggs

Using a spatula, gently stir the eggs and vegetables together, ensuring the eggs are evenly mixed with the veggies.
Continue to cook until the eggs are fully cooked but still moist. Be careful not to overcook, as the eggs should remain tender and creamy.

Step 7: Adjust Seasoning

Taste and adjust the seasoning with more salt, pepper, or thyme if needed.
Once done, remove the skillet from the heat and serve hot.


How to Serve

This Vegetable Egg Sauce is perfect with a slice of bread, but there are other great ways to enjoy it:

  • Classic Style: Serve with toast or soft bread. It’s a quick and satisfying breakfast.
  • On the Go: Spread it on a slice of whole wheat bread for a portable, healthy snack.
  • With a Side: Pair it with a cup of hot tea or freshly squeezed orange juice for a refreshing meal.

Customize Your Vegetable Egg Sauce

Feel free to get creative with this dish and make it your own with these variations:

  • Cheese Lover’s Delight: Add a handful of grated cheese (cheddar, mozzarella, or feta) into the eggs for a creamy, cheesy version.
  • Spicy Kick: Add chopped scotch bonnet pepper or chili flakes for some heat!
  • Meat Additions: For a non-vegetarian version, add diced sausages, bacon bits, or chicken strips for extra protein.
  • Greens Galore: Swap spinach for kale, arugula, or any leafy green you prefer for added nutrients.

How to Make Vegetable Egg Sauce Ahead / Storage Tips

This dish is best served fresh, but you can store leftovers for later:

  • In the Fridge: Store any leftovers in an airtight container for up to 2 days. Reheat on the stove or in the microwave until heated through.
  • Freezing: While the eggs may change texture slightly after freezing, you can store the sauce in a freezer-safe container for up to 1 month. Thaw overnight in the fridge and reheat thoroughly before serving.

Frequently Asked Questions (FAQs)

Q: Can I use frozen vegetables instead of fresh ones?
A: Yes, you can use frozen vegetables. Just make sure to thaw them and drain any excess moisture before adding them to the skillet.

Q: Can I make this dish in advance?
A: While this dish is best enjoyed fresh, you can prepare the vegetables ahead of time and store them in the fridge for up to 2 days. Just scramble the eggs when you’re ready to serve.

Q: What bread should I use?
A: You can use any bread you like! Soft white bread, whole wheat, or even a crusty baguette are perfect choices for pairing with this dish.

Q: How can I make the egg sauce fluffier?
A: To make your eggs fluffier, you can add a splash of milk or cream to the beaten eggs before cooking.


Final Thoughts

Vegetable Egg Sauce is a simple yet versatile dish that’s perfect for any time of the day. Whether you’re in a rush or have more time to savor it, this recipe is quick, nutritious, and full of flavor. Customize it to suit your taste and enjoy the perfect balance of eggs and vegetables!

Vegetable Egg Sauce

Vegetable Egg Sauce is a quick and easy dish that’s bursting with flavor and nutrition. It’s perfect for a busy weekday or a weekend brunch with the family. The eggs provide a hearty base, while the colorful veggies add texture, sweetness, and vitamins to each bite. Whether served with bread, rice, or on its own, this dish will soon become a go-to meal in your kitchen!

  • Prep Time: 5 mins
  • Cook Time: 10 - 12 mins
  • Marinate: None
  • Serving Size: 2 - 3 People
Pin

Ingredients

For the Sauce

Instructions

  1. The eggs should be cracked and mixed thoroughly in a bowl.
  2. Place aside. In a skillet, melt the vegetable oil by heating it over a medium flame.
  3. In the skillet, add the minced garlic and finely sliced onions.
  4. The items should be sautéed until the garlic develops a fragrant flavor and the onions become transparent.
  5. The mixed vegetables should be added to the skillet and cooked for a few minutes until just softened.
  6. Salt, pepper, thyme, and curry powder are used to season the vegetables.
  7. Stirring helps the spices adhere to the vegetables.
  8. In the skillet with the veggies, add the beaten eggs.
  9. The edges will start to harden after about a minute or two of untouched cooking.
  10. To combine the eggs and vegetables, gently whisk the mixture.
  11. Cook the eggs more until they are done but still a little wet.
  12. If needed, adjust the seasoning.
Instagram Icon

Did you make this recipe? Tag or mention @joyfulcook_. I would love to hear from you!

Recipe Video

What do you think?

Rate this recipe

Average Rating: 0 / 5

Leave a Reply

Your email address will not be published. Required fields are marked *