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 | |
/* | |
update cart on quantity field value change | |
*/ | |
function wc_qty_change_update_cart(){?> | |
<script> | |
jQuery(".qty").blur(function(){ | |
jQuery("[name='update_cart']").trigger("click"); |
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 | |
/* | |
custom filter hook | |
*/ | |
function custom_filter_something_cool() { | |
$output = 'Hello World'; | |
return apply_filters('my_custom_filter', $output); |
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 | |
/* | |
custom action hook | |
*/ | |
do_action( 'my_custom_action' ); | |
//Place the code for the action when fired | |
function my_action_something_cool() { |
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 | |
/** | |
* product title with sku | |
*/ | |
function woo_product_title_with_sku() { | |
global $product; | |
echo '<span class="loop-title-sku">Sku: ' . $product->get_sku() . '</span><br>'; | |
} |
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 | |
function ik_wc_discount_total() { | |
global $woocommerce; | |
$discount_total = 0; | |
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values) { | |
$_product = $values['data']; | |
if ( $_product->is_on_sale() ) { | |
$regular_price = $_product->get_regular_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 | |
function ci_admin_posts_filter( $query ) | |
{ | |
global $pagenow; | |
if ( is_admin() && $pagenow=='edit.php' && isset($_GET['ADMIN_SEARCH_FIELD_NAME']) && $_GET['ADMIN_SEARCH_FIELD_NAME'] != '') { | |
$query->query_vars['meta_value'] = $_GET['ADMIN_SEARCH_FIELD_NAME']; | |
} | |
} |
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 | |
// Customize woocommerce product data tabs | |
function customize_woo_description_tab( $tabs ) { | |
$tabs['description']['callback'] = 'woo_description_tab_content'; // Custom description callback | |
return $tabs; | |
} |
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 woocommerce product data tabs | |
*/ | |
function remove_woo_product_data_tabs( $tabs ) { | |
//unset will remove the product tabs | |
unset( $tabs['description'] ); // Remove the description tab | |
unset( $tabs['reviews'] ); // Remove the reviews tab |
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 | |
/** | |
* Reorder woocommerce product data tabs | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'woo_reorder_product_data_tabs', 98 ); | |
function woo_reorder_product_data_tabs( $tabs ) { | |
$tabs['reviews']['priority'] = 5; // Reviews first | |
$tabs['description']['priority'] = 10; // Description second | |
$tabs['additional_information']['priority'] = 15; // Additional information third |
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 | |
function woo_custom_physical_product_tab( $tabs ) { | |
global $product; | |
// Ensure it doesn't show for virtual products | |
if ( ! $product->is_virtual() ) { | |
$tabs['shipping'] = array( | |
'title' => __( 'Shipping', 'textdomain' ), | |
'callback' => 'woo_custom_shipping_tab', | |
'priority' => 50, |