This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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] ); | |
} | |
This file contains hidden or 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_sale_flash', 'add_percentage_to_sale_badge', 20, 3 ); | |
function add_percentage_to_sale_badge( $html, $post, $product ) { | |
if( $product->is_type('variable')){ | |
$percentages = array(); | |
// Get all variation prices | |
$prices = $product->get_variation_prices(); | |
// Loop through variation prices |
This file contains hidden or 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', 'musilda_ga_code' ); | |
function musilda_ga_code(){ | |
?> | |
<!-- Global site tag (gtag.js) - Google Analytics --> | |
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-169040585-1"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('js', new Date()); |
This file contains hidden or 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 | |
//Save cart weight | |
add_action( 'woocommerce_checkout_update_order_meta', 'musilda_save_cart_weight' ); | |
function musilda_save_cart_weight( $order_id ) { | |
$weight = WC()->cart->get_cart_contents_weight(); | |
update_post_meta( $order_id, 'order-weight', $weight ); | |
} | |
//Update all orders | |
$args = array( |
This file contains hidden or 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( 'manage_edit-shop_order_sortable_columns', 'musilda_order_sortable_column' ); | |
function musilda_order_sortable_column( $columns ) { | |
$columns = array( 'order-weight' => 'order-weight' ); | |
return $columns; | |
} |
This file contains hidden or 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( 'manage_shop_order_posts_custom_column', 'musilda_show_weight_in_order_column' ); | |
function musilda_show_weight_in_order_column( $column ) { | |
global $post; | |
if ( empty( $post->ID ) ) { | |
return; | |
} |
This file contains hidden or 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( 'manage_shop_order_posts_columns', 'musilda_custom_order_column', 11 ); | |
function musilda_custom_order_column( $columns ) { | |
$expanded_columns = []; | |
foreach ( $columns as $key => $value ) { | |
$expanded_columns[$key] = $value; | |
if ( $key == 'name' ) { |