This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'US' => array( | |
'default_fee' => 100, | |
'over_threshold_fee' => 5, | |
'under_threshold_fee' => 10 | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AX Åland Islands | |
AF Afghanistan | |
AL Albania | |
DZ Algeria | |
AD Andorra | |
AO Angola | |
AI Anguilla | |
AQ Antarctica | |
AG Antigua and Barbuda | |
AR Argentina |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define the targeted countries and the corresponding fee | |
$target_countries = array( | |
'US' => 10, // Add $10 fee for customers from the United States | |
'CA' => 15, // Add $15 fee for customers from Canada | |
// Add more countries and fees as needed | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_email_header', array( $object, 'email_header' ) ); | |
add_action( 'woocommerce_email_footer', array( $object, 'email_footer' ) ); | |
add_action( 'woocommerce_email_order_details', array( $object, 'order_details' ), 10, 4 ); | |
add_action( 'woocommerce_email_order_details', array( $object, 'order_schema_markup' ), 20, 4 ); | |
add_action( 'woocommerce_email_order_meta', array( $object, 'order_meta' ), 10, 3 ); | |
add_action( 'woocommerce_email_customer_details', array( $object, 'customer_details' ), 10, 3 ); | |
add_action( 'woocommerce_email_customer_details', array( $object, 'email_addresses' ), 20, 3 ); | |
add_action( 'woocommerce_email_order_details', array( $this, 'generate_order_data' ), 20, 3 ); | |
add_action( 'woocommerce_email_order_details', array( $this, 'output_email_structured_data' ), 30, 3 ); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Brad Dalton | |
* @link https://wpsites.net/?p=114708 | |
* @copyright https://wpsites.net/disclosure-privacy/ | |
*/ | |
// Hook to display stock quantity on the product page | |
add_action( 'woocommerce_before_add_to_cart_button', 'display_stock_quantity', 10 ); | |
// Function to display stock quantity for each product |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function enqueue_custom_scripts() { | |
wp_enqueue_script('custom-script', get_stylesheet_directory_uri() . '/js/custom-script.js', array('jquery'), '1.0', true); | |
} | |
add_action('wp_enqueue_scripts', 'enqueue_custom_scripts'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
// Add click event to submenu items | |
$('.sub-menu li').on('click', function() { | |
// Remove 'active' class from all submenu items | |
$('.sub-menu li').removeClass('active'); | |
// Add 'active' class to the clicked submenu item | |
$(this).addClass('active'); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('pre_get_posts', 'wc_exclude_sale_items_from_shop_page'); | |
function wc_exclude_sale_items_from_shop_page($query) { | |
if ( is_admin() || ! $query->is_main_query() ) { | |
return; | |
} | |
// Check if it's the main shop page | |
if ( is_shop() ) { | |
$query->set('meta_query', array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('woocommerce_settings_tabs_exchange_rates', 'add_exchange_rate_usd_field'); | |
add_action('woocommerce_admin_field_number', 'add_exchange_rate_usd_field'); | |
// Add custom exchange rate field to WooCommerce settings under a new tab | |
function add_exchange_rate_usd_field() { | |
woocommerce_admin_fields(array( | |
array( | |
'type' => 'title', | |
'id' => 'exchange_rates_tab_title', | |
'title' => __('Exchange Rates', 'woocommerce'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('woocommerce_new_order', 'set_custom_currency_for_manual_orders', 10, 1); | |
function set_custom_currency_for_manual_orders($order_id) { | |
// Check if the order is manual (admin-created) by looking at the order status | |
$order = wc_get_order($order_id); | |
$order_status = $order->get_status(); | |
// Specify the custom currency code you want to set for manual orders | |
$custom_currency_code = 'EUR'; | |
// Check if the order is manual (e.g., status is 'on-hold' for admin-created orders) |
NewerOlder