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 | |
/** | |
* Product loop sale flash | |
* | |
* @author Vivek R @ WPSTuffs.com | |
* @package WooCommerce/Templates | |
* @version 1.6.4 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
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
/** | |
* Will make the Bookings calender default to the month with the first available booking. | |
*/ | |
add_filter( 'wc_bookings_calendar_default_to_current_date', '__return_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
/*----------------------------------------------------------------------------*/ | |
// redirects for login / logout | |
/*----------------------------------------------------------------------------*/ | |
add_filter('woocommerce_login_redirect', 'login_redirect'); | |
function login_redirect($redirect_to) { | |
return home_url(); | |
} |
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
$name = $mysqli->query("SELECT name FROM contacts WHERE id = 5")->fetch_object()->name; |
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 | |
function custom_wc_coupon_validity( $valid, $product, $this, $values ) { | |
if ( $product->is_on_sale() ) { | |
return false; | |
} | |
return $valid; | |
} |
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 | |
/** | |
* Hook into order API response to add custom field data. | |
* | |
* @param $order_data array | |
* @param $order WC_Order | |
* @param $fields array | |
* @param $server 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
<?php | |
/* | |
Localizations: | |
- [Spanish](https://gist.github.com/MatthewEppelsheimer/1498955#gistcomment-3317461) props @chdgp | |
UPDATED: 2020-03-09 |
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
/** | |
* Get All orders IDs for a given product ID. | |
* | |
* @param integer $product_id (required) | |
* @param array $order_status (optional) Default is 'wc-completed' | |
* | |
* @return array | |
*/ | |
function get_orders_ids_by_product_id( $product_id, $order_status = array( 'wc-completed' ) ){ | |
global $wpdb; |
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 // only copy if needed | |
/** | |
* Add a custom action to order actions select box on edit order page | |
* Only added for paid orders that haven't fired this action yet | |
* | |
* @param array $actions order actions array to display | |
* @return array - updated actions | |
*/ | |
function sv_wc_add_order_meta_box_action( $actions ) { |
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_order_actions', 'custom_wc_order_action', 10, 1 ); | |
function custom_wc_order_action( $actions ) { | |
if ( is_array( $actions ) ) { | |
$actions['custom_action'] = __( 'My custom action' ); | |
} | |
return $actions; | |
} |
OlderNewer