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
/* | |
flatsome [ux-countdown] shortcode usage | |
*/ | |
//Admin side shortcode | |
[ux_countdown year="2019" month="10" day="30" time="15:00"] | |
//Add below in functions.php | |
echo do_shortcode('[ux_countdown year="2019" month="10" day="30" time="15:00"]'); |
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 another email recipient for admin New Order emails if a shippable product is ordered for a specific city | |
* | |
* @param string $recipient a comma-separated string of email recipients (will turn into an array after this filter!) | |
* @param \WC_Order $order the order object for which the email is sent | |
* @return string $recipient the updated list of email recipients | |
*/ | |
function mr_wc_conditional_email_recipient( $recipient, $order ) { | |
// Bail on WC settings pages since the order object isn't yet set yet | |
// Not sure why this is even a thing, but shikata ga nai |
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( 'wp_footer', 'scripts_for_adding_country_prefix_on_billing_phone' ); | |
function scripts_for_adding_country_prefix_on_billing_phone(){ | |
?> | |
<script type="text/javascript"> | |
( function( $ ) { | |
$( document.body ).on( 'updated_checkout', function(data) { | |
var ajax_url = "<?php echo admin_url('admin-ajax.php'); ?>", | |
country_code = $('#billing_country').val(); | |
var ajax_data = { |
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 | |
/** | |
* Ordena produtos fora de estoque no final do catálogo | |
* source: https://stackoverflow.com/a/44597448 | |
*/ | |
add_filter('posts_clauses', 'order_by_stock_status'); | |
function order_by_stock_status($posts_clauses) { | |
global $wpdb; | |
// only change query on WooCommerce loops |
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
/** | |
* Ordena produtos fora de estoque no final do catálogo | |
* source: https://stackoverflow.com/a/44597448 | |
*/ | |
add_filter('posts_clauses', 'order_by_stock_status'); | |
function order_by_stock_status($posts_clauses) { | |
global $wpdb; | |
// only change query on WooCommerce loops | |
if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy())) { | |
$posts_clauses['join'] .= " INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_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
<ol> | |
<li><a href="/permalink/#subheading-1">Subheading 1</a></li> | |
<li><a href="/permalink/#subheading-2">Subheading 2</a></li> | |
<li><a href="/permalink/#subheading-3">Subheading 3</a></li> | |
<li><a href="/permalink/#subheading-4">Subheading 4</a></li> | |
<li><a href="/permalink/#subheading-5">Subheading 5</a></li> | |
<li><a href="/permalink/#subheading-6">Subheading 6</a></li> | |
<li><a href="/permalink/#subheading-7">Subheading 7</a></li> | |
<li><a href="/permalink/#subheading-8">Subheading 8</a></li> | |
<li><a href="/permalink/#subheading-9">Subheading 9</a></li> |
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
if ( isset( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ) { | |
$http_x_headers = explode( ',', $_SERVER['HTTP_CF_CONNECTING_IP'] ); | |
$_SERVER['REMOTE_ADDR'] = $http_x_headers[0]; | |
} |
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
/** | |
* Não permitir a troca de status de pedidos cancelados. | |
* Muda o pedido para apovação manual | |
*/ | |
add_filter( 'woocommerce_before_order_object_save', 'prevent_cancelled_order_status_change', 10, 2 ); | |
function prevent_cancelled_order_status_change( $order, $data_store ) { | |
$changes = $order->get_changes(); | |
if (isset($changes['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
/** | |
* Remove produtos que a variação não tem em estoque | |
* @see https://github.com/woocommerce/woocommerce/issues/20689 | |
*/ | |
add_action( 'woocommerce_before_shop_loop_item_title', 'remove_out_of_stock_products_from_active_filter' ); | |
function remove_out_of_stock_products_from_active_filter(){ | |
if (isset($_GET['filter_tamanho'])) { | |
global $product; | |
if ($product->is_type('variable')) { | |
$variations = $product->get_available_variations(); |
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 | |
/* | |
Plugin Name: Woo Close Store | |
Plugin URI: https://github.com/gabriserra/woo-close-store | |
Description: Woo Close Store handle store closing phase. | |
Version: 0.1 | |
Author: Gabriele Serra | |
Author URI: https://gabripr0.altervista.org | |
Text Domain: woo-close-store | |
License: MIT |