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 that will automatically update ACF field groups via JSON file update. | |
* | |
* @link http://www.advancedcustomfields.com/resources/synchronized-json/ | |
*/ | |
function jp_sync_acf_fields() { | |
// vars |
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 // Do not copy this line. | |
// This is a filter to disable Multi-Currency in WooCommerce Payments. | |
add_filter( | |
'pre_option__wcpay_feature_customer_multi_currency', | |
function ( $pre_option, $option, $default ) { | |
return '0'; | |
}, | |
10, | |
3 |
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 // do not copy this line | |
/** | |
* Both functions below work the same, they just apply to categories and tags respectively. | |
* They exclude the defined IDs from being included in related products in WooCommerce. | |
* | |
* Note: The results are initially cached, so add this and then clear transients before saying it doesn't work. | |
* | |
* @link https://gist.github.com/jessepearson/dcf49d766cd1647465655fe9a14e51f2 | |
* @param [array] $categories/$tags The array of categories or tags that are being used for related products. |
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 // Do not copy this line. | |
/** | |
* Will clear out all the specified completed scheduled actions, 5000 at a time. | |
*/ | |
function clear_woocommerce_scheduled_actions_20200609() { | |
global $wpdb; | |
$limit = 5000; | |
$actions_table = $wpdb->prefix . 'actionscheduler_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
<?php // Do not copy this line | |
/** | |
* This will turn on deferred transactional emails in WooCommerce. This may help if you | |
* are experiencing slow checkouts or checkout timeouts. | |
*/ | |
add_filter( 'woocommerce_defer_transactional_emails', '__return_true' ); |
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 // do not copy this line | |
/** | |
* 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
<?php // do not copy this line | |
/** | |
* add_new_topic_hooks will add a new webhook topic hook. | |
* @param array $topic_hooks Esxisting topic hooks. | |
*/ | |
function add_new_topic_hooks( $topic_hooks ) { | |
// Array that has the topic as resource.event with arrays of actions that call that topic. |
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 // do not copy this line | |
/** | |
* Code goes in theme functions.php | |
* | |
* In this example we're creating a booking 1 week after a booking is paid for. | |
* This does not create another order or payment, just an additional booking. | |
* $exact is false meaning if our slot is taken, the next available slot will be used. | |
* @link https://docs.woocommerce.com/document/creating-bookings-programatically/ | |
*/ |
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 // do not copy this line | |
function rewrite_wc_bookings_get_time_slots_html( $block_html, $available_blocks, $blocks ) { | |
$block_html = ''; | |
foreach ( $available_blocks as $block => $quantity ) { | |
if ( $quantity['available'] > 0 ) { | |
$block_html .= '<li class="block" data-block="' . esc_attr( date( 'Hi', $block ) ) . '"><a href="#" data-value="' . date( 'c', $block ) . '">' . date_i18n( get_option( 'time_format' ), $block ) . ' <small class="booking-spaces-left">(' . sprintf( _n( '%d left', '%d left', $quantity['available'], 'woocommerce-bookings' ), absint( $quantity['available'] ) ) . ')</small></a></li>'; | |
} |
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 // do not copy this line | |
/** | |
* Will put bookings into a Confirmed status if they were paid for via COD. | |
* | |
* @param int $order_id The order id | |
*/ | |
function set_cod_bookings_confirmed_20170825( $order_id ) { | |
// Get the order, then make sure its payment method is COD. |
NewerOlder