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
function tl_save_error() { | |
update_option( 'plugin_error', ob_get_contents() ); | |
} | |
add_action( 'activated_plugin', 'tl_save_error' ); | |
/* Then to display the error message: */ | |
echo get_option( 'plugin_error' ); |
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
function wc_varb_price_range( $wcv_price, $product ) { | |
$prefix = sprintf('%s: ', __('From', 'wcvp_range')); | |
$wcv_reg_min_price = $product->get_variation_regular_price( 'min', true ); | |
$wcv_min_sale_price = $product->get_variation_sale_price( 'min', true ); | |
$wcv_max_price = $product->get_variation_price( 'max', true ); | |
$wcv_min_price = $product->get_variation_price( 'min', true ); | |
$wcv_price = ( $wcv_min_sale_price == $wcv_reg_min_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
$columns: ( | |
1: 100%, | |
2: 50%, | |
3: 33.33%, | |
4: 25%, | |
5: 20%, | |
6: 16.66%, | |
7: 14.28%, | |
8: 12.5%, | |
9: 11.11% |
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
foreach (WC()->session->get('shipping_for_package_0')['rates'] as $method_id => $rate) { | |
if (WC()->session->get('chosen_shipping_methods')[0] == $method_id) { | |
$rate_label = $rate->label; // The shipping method label name | |
$rate_cost_excl_tax = floatval($rate->cost); // The cost excluding tax | |
// The taxes cost | |
$rate_taxes = 0; | |
foreach ($rate->taxes as $rate_tax) | |
$rate_taxes += floatval($rate_tax); | |
// The cost including tax |
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
add_filter('terms_clauses', function ( $pieces, $taxonomies, $args ) { | |
if (!isset($args['wpse_exclude_top']) || 1 !== $args['wpse_exclude_top'] | |
) | |
return $pieces; | |
$pieces['where'] .= ' AND tt.parent > 0'; | |
return $pieces; | |
}, 10, 3); |
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 | |
// 1. Deactivate the default WooCommerce cleanup draft orders cron | |
add_action( 'init', 'deactivate_woocommerce_cleanup_draft_orders' ); | |
function deactivate_woocommerce_cleanup_draft_orders() { | |
if ( function_exists( 'as_next_scheduled_action' ) ) { | |
$timestamp = as_next_scheduled_action( 'woocommerce_cleanup_draft_orders' ); | |
if ( $timestamp ) { |
OlderNewer