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 | |
// Add WooCommerce customer username to edit/view order admin page | |
add_action( 'woocommerce_admin_order_data_after_billing_address', 'woo_display_order_username', 10, 1 ); | |
function woo_display_order_username( $order ){ | |
global $post; | |
$customer_user = get_post_meta( $post->ID, '_customer_user', true ); | |
echo '<p><strong style="display: block;">'.__('Customer Username').':</strong> <a href="user-edit.php?user_id=' . $customer_user . '">' . get_user_meta( $customer_user, 'nickname', true ) . '</a></p>'; |
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 if (is_cart()) { ?> | |
<script type="text/javascript"> | |
// Each time quantity in the cart changes, trigger update | |
// cart option | |
jQuery('div.woocommerce').on('change', '.qty', function(){ | |
// Make sure the button is enabled before triggering the event | |
// otherwise this won't work. | |
jQuery("[name='update_cart']").prop("disabled", false); | |
jQuery("[name='update_cart']").trigger("click"); | |
}); |
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
// 06-05-2019 Retain Quote Billing & Shipping Country ELSE assign Location based on IP (Geolocation) | |
function remove_checkout_optional_fields_label_script() { | |
// Only on checkout page | |
if( ! ( is_checkout() && ! is_wc_endpoint_url() ) ) return; | |
$optional = ' <span class="optional">(' . esc_html__( 'optional', 'woocommerce' ) . ')</span>'; | |
?> | |
<script> | |
jQuery(function($){ | |
// On "update" checkout form event remove option to select countries | |
$(document.body).on('update_checkout', function(){ |
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
function woo_seo_noindex_special_pages () { | |
global $post; | |
$woocommerce_pages = array('cart', 'checkout', 'order-received', 'order-tracking', | |
'my-account', 'logout', 'lost-password', 'mijireh-secure-checkout'); | |
$slug = get_post($post)->post_name; | |
if (in_array($slug, $woocommerce_pages)) { | |
echo '<meta name="robots" content="noindex,follow"/>' . "\n"; | |
} |
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
User-agent: * | |
Disallow: /wp-admin/ | |
Disallow: /?s= | |
Disallow: /search/ | |
Allow: /admin/admin-ajax.php | |
Disallow: /cgi-bin/ | |
Disallow: /wp-content/cache/ | |
Disallow: /trackback/ | |
Disallow: */trackback/ |
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
/** | |
* Remove produtos que a variação não tem em estoque | |
* Removes products from Filter where the variation is out of stock | |
* @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_size'])) { | |
global $product; | |
if ($product->is_type('variable')) { |
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 | |
/** | |
* 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 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 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 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 |
OlderNewer