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 | |
// WooCommerce > Settings > Shipping > Shipping Options -> Debug Mode | |
// For some reason (probably a plugin conflict), the woocommerce_shipping_debug_mode option would consistently recheck itself | |
add_action( 'admin_init', 'override_shipping_debug'); | |
function override_shipping_debug(){ | |
update_option('woocommerce_shipping_debug_mode','no'); | |
} |
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 | |
function add_product_column( $columns ) { | |
//add column | |
$columns['new_column'] = __( 'New column', 'woocommerce' ); | |
return $columns; | |
} | |
add_filter( 'manage_edit-product_columns', 'add_product_column', 10, 1 ); | |
function add_product_column_content( $column, $postid ) { |
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 | |
// Path file = yoursite.com/wp-content/file.pdf | |
function action_woocommerce_order_status_changed( $order_id, $old_status, $new_status, $order ) { | |
// Compare | |
if ( $new_status == 'completed' && $order->get_payment_method() == 'dobirka' ) { | |
// Mailer | |
$mailer = WC()->mailer(); | |
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_filter( 'woocommerce_display_item_meta', 'show_stock_status_in_email', 10, 3 ); | |
function show_stock_status_in_email( $html, $item, $args ) { | |
// gets the product object | |
$product = $item->get_product(); | |
// gets stock status product | |
$stock_status = $product->get_stock_status(); | |
// show it after the product name | |
$html .= '<p style="margin:0;"><strong>(' . $stock_status . ')</strong></p>'; | |
return $html; |
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 | |
/* | |
// source: https://stackoverflow.com/questions/51327748/woocommerce-check-if-product-is-out-of-stock-and-doesnt-allow-backorders | |
*/ | |
add_action('woocommerce_single_product_summary','show_stock_single',5); | |
function show_stock_single() { | |
global $product; | |
$StockQ=$product->get_stock_quantity(); | |
if ($StockQ>=1)//Stock is Available |
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_filter('woocommerce_get_availability_text', 'themeprefix_change_soldout', 10, 2 ); | |
/** | |
* Change Sold Out Text to Something Else | |
*/ | |
function themeprefix_change_soldout ( $text, $product) { | |
if ( !$product->is_in_stock() ) { | |
$text = '<div class="">Sold out.</div>'; | |
} |
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 | |
// The following hooked functions will allow you to make everything purchasable: | |
// Change all products stock statuses to 'instock' | |
add_filter( 'woocommerce_product_get_stock_status', 'filter_get_stock_status_callback', 10, 2 ); | |
add_filter( 'woocommerce_product_variation_get_stock_status', 'filter_get_stock_status_callback', 10, 2 ); | |
function filter_get_stock_status_callback( $stock_status, $product ){ | |
return is_admin() ? $stock_status : 'instock'; | |
} | |
// Enable backorders on all products |
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
-- Products | |
DELETE relations.*, taxes.*, terms.* | |
FROM wp_term_relationships AS relations | |
INNER JOIN wp_term_taxonomy AS taxes | |
ON relations.term_taxonomy_id=taxes.term_taxonomy_id | |
INNER JOIN wp_terms AS terms | |
ON taxes.term_id=terms.term_id | |
WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type='product'); | |
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = 'product'); | |
DELETE FROM wp_posts WHERE post_type = 'product'; |
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
User-agent: * | |
Disallow: /wp-admin/ | |
Disallow: /wp-admin/admin-ajax.php | |
User-agent: libwww-perl | |
User-agent: libwwwperl | |
User-agent: attach | |
User-agent: ASPSeek | |
User-agent: appie | |
User-agent: AbachoBOT |
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
Header set X-XSS-Protection "1; mode=block" | |
Header set X-Content-Type-Options nosniff | |
<Files xmlrpc.php> | |
order deny,allow | |
deny from all | |
</Files> | |
<Files 403.shtml> | |
order allow,deny |
NewerOlder