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_product_single_add_to_cart_text', 'woo_custom_cart_button_text', 999 ); | |
function woo_custom_cart_button_text( $text ) { | |
foreach( WC()->cart->get_cart() as $cart_item_key => $values ) { | |
$_product = $values['data']; | |
if( get_the_ID() == $_product->get_id() ) { | |
return 'Produkt je již v košíku - přidat znovu?' ; |
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 | |
//Remove cross sells products | |
remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); | |
//Change cross sells columns number | |
add_filter( 'woocommerce_cross_sells_columns', 'musilda_change_cross_sells_columns' ); | |
function musilda_change_cross_sells_columns( $columns ) { | |
return 3; | |
} | |
//Change number of cross sell products | |
add_filter( 'woocommerce_cross_sells_total', 'musilda_change_cross_sells_product_number' ); |
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 | |
//Change sorting | |
add_filter( 'woocommerce_get_catalog_ordering_args', 'musilda_show_instock_products_first', 9999, 3 ); | |
function musilda_show_instock_products_first( $args, $orderby, $order ) { | |
if( $orderby == 'stock_status' ){ | |
$args['orderby'] = 'meta_value'; | |
$args['order'] = 'ASC'; | |
$args['meta_key'] = '_stock_status'; |
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( 'pre_get_posts', 'musilda_hide_out_of_stock_products' ); | |
function musilda_hide_out_of_stock_products( $q ) { | |
if ( ! $q->is_main_query() || is_admin() ) { | |
return; | |
} | |
if ( $outofstock_term = get_term_by( 'name', 'outofstock', 'product_visibility' ) ) { |
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_default_catalog_orderby', 'musilda_default_random_order' ); | |
function musilda_default_random_order(){ | |
return 'rand'; | |
} | |
add_filter( 'woocommerce_default_catalog_orderby', 'musilda_default_price_order' ); | |
function musilda_default_price_order(){ | |
return array( 'price', 'ASC' ); |
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( 'init', 'remove_output_structured_data' ); | |
function remove_output_structured_data() { | |
remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); | |
} |
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( 'woocommerce_before_shop_loop', 'musilda_categories' ); | |
function musilda_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 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( 'toret_xml_feeds_get_price', 'musilda_sale_price_xml_feeds', 10, 2 ); | |
function musilda_sale_price_xml_feeds( $price, $product ){ | |
$sale_price = $product->get_sale_price(); | |
if ( $sale_price ) { | |
return $sale_price; |
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_register_shop_order_post_statuses', 'musilda_register_custom_order_status' ); | |
function musilda_register_custom_order_status( $order_statuses ){ | |
$order_statuses['wc-custom-status'] = array( | |
'label' => _x( 'Custom Status', 'Order status', 'woocommerce' ), | |
'public' => false, | |
'exclude_from_search' => false, | |
'show_in_admin_all_list' => true, | |
'show_in_admin_status_list' => true, |