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
<?php | |
include_once(WC()->plugin_path().'/includes/admin/reports/class-wc-admin-report.php'); | |
add_filter( 'woocommerce_admin_reports', 'my_custom_woocommerce_admin_reports', 10, 1 ); | |
function my_custom_woocommerce_admin_reports( $reports ) { | |
$sales_by_country = array( | |
'sales_by_country' => array( | |
'title' => 'Sales By Country', | |
'description' => '', | |
'hide_title' => true, | |
'callback' => 'sales_by_country_callback', |
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
<?php | |
add_filter( 'woocommerce_thankyou_order_received_text', 'gunshop_received_text', 10, 2 ); | |
function gunshop_received_text( $text, $order ){ | |
$payment = $order->get_payment_method(); | |
if ( 'dobirka' === $payment ) { | |
$text = 'Děkujeme za objednávku, zboží zaplatíte až při převzetí.'; | |
} |
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
<?php | |
add_action( 'woocommerce_before_shop_loop', 'metaltrade_categories', 5 ); | |
function metaltrade_categories(){ | |
global $wp_query; | |
if( empty( $wp_query->queried_object->term_id ) ){ | |
$parent = 0; | |
} else { | |
$parent = $wp_query->queried_object->term_id; |
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 no_wordpress_errors(){ | |
return 'Something is wrong!'; | |
} | |
add_filter( 'login_errors', 'no_wordpress_errors' ); |
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
<?php | |
global $wpdb; | |
$posts = $wpdb->get_results( | |
"SELECT wposts.* | |
FROM ".$wpdb->prefix."posts wposts, ".$wpdb->prefix."icl_translations wicl_translations | |
WHERE wicl_translations.element_id = wposts.ID | |
AND wposts.post_status = 'publish' | |
AND wicl_translations.language_code = 'en' | |
AND wicl_translations.element_type = 'post_post' |
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
<?php | |
add_action( 'wp_head', 'nazev_webu_add_header' ); | |
public function nazev_webu_add_header() { | |
if ( strpos( get_site_url(), 'musilda.com' ) > 0) { | |
?> | |
<?php | |
} | |
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
<?php | |
add_filter( 'woocommerce_my_account_my_address_formatted_address', 'toret_my_account_fields', 10, 3 ); | |
function toret_my_account_fields( $fields, $customer_id, $name ) { | |
//$fields['position'] = get_user_meta( $customer_id, $name . '_vat_number_2', true ); | |
$fields['position'] = 'Manager'; | |
return $fields; | |
} |
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
<?php | |
add_filter( 'woocommerce_package_rates', 'musilda_cart_price_free_shipping', 10, 2 ); | |
function musilda_cart_price_free_shipping( $rates, $package ) { | |
if( 1000 < WC()->cart->get_displayed_subtotal() ) { | |
foreach($rates as $key => $item){ | |
$rates[$key]->cost = 0; | |
$rates[$key]->tax = 0; | |
$rates[$key]->taxes = false; | |
} |
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
<?php | |
add_filter( 'wc_order_is_editable', 'musilda_allow_edit_order' ); | |
function musilda_allow_edit_order( $editable, $statuses, $order ){ | |
if ( 'completed' === $order->get_status() ) { | |
$editable = true; | |
} | |
return $editable; |
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
<?php | |
add_filter( 'woocommerce_order_is_paid_statuses', 'musilda_change_paid_statuses' ); | |
function musilda_change_paid_statuses( $statuses ){ | |
foreach( $statuses as $key => $status ){ | |
if ( 'processing' === $status ) { | |
unset( $statuses[$key] ); | |
} | |