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
add_filter ('bulk_actions-edit-shop_order','register_bulk_action'); | |
function register_bulk_action($bulk_actions){ | |
$bulk_actions['mark_being_processed'] = 'Mark Being Processed'; | |
return $bulk_actions; | |
} | |
add_action ('admin_action_mark_being_processed','bulk_process_custom_status'); | |
function bulk_process_custom_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 // only copy if needed! | |
/** | |
* Register new status | |
* Tutorial: http://www.sellwithwp.com/woocommerce-custom-order-status-2/ | |
**/ | |
function register_awaiting_shipment_order_status() { | |
register_post_status( 'wc-awaiting-shipment', array( | |
'label' => 'Awaiting shipment', | |
'public' => 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
https://medium.com/@jm_c/mysql-crashing-innodb-mmap-bytes-failed-errno-12-64d5b801b2f2 | |
https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04#conclusion |
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
//Total Sales per item | |
// Credit to https://devin.org/woocommerce-how-to-get-total-sales-of-all-products-number/ | |
$order_items = apply_filters( 'woocommerce_reports_top_earners_order_items', $wpdb->get_results( " | |
SELECT order_item_meta_2.meta_value as product_id, SUM( order_item_meta.meta_value ) as line_total FROM {$wpdb->prefix}woocommerce_order_items as order_items | |
LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id | |
LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id | |
LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.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
SELECT | |
wp_posts.post_title AS Product, | |
wp_postmeta1.meta_value AS SKU, | |
wp_postmeta2.meta_value AS Price, | |
GROUP_CONCAT( wp_terms.name ORDER BY wp_terms.name SEPARATOR ', ' ) AS ProductCategories | |
FROM wp_posts | |
LEFT JOIN wp_postmeta wp_postmeta1 | |
ON wp_postmeta1.post_id = wp_posts.ID | |
AND wp_postmeta1.meta_key = '_sku' | |
LEFT JOIN wp_postmeta wp_postmeta2 |
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
UPDATE wp_postmeta m | |
JOIN wp_posts p ON m.post_id=p.id | |
AND m.meta_key = '_sale_price' | |
SET m.meta_value = '' |
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
<!-- Thanks Fooman --> | |
<!-- Link URL https://github.com/magento/magento2/issues/7623#issuecomment-263995878 --> |
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 bin/magento config:set --lock dev/debug/debug_logging 1 && php bin/magento cache:flush |
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
SELECT product.ID as product_id, product.post_title as product_name, replace(product.post_content, '"', "'") as product_content, product_sku.meta_value as product_sku, product_price.meta_value as product_price, product_weight.meta_value as product_weight | |
FROM wp_posts as product | |
LEFT JOIN wp_postmeta as product_sku ON product.ID = product_sku.post_ID | |
LEFT JOIN wp_postmeta as product_price ON product.ID = product_price.post_ID | |
LEFT JOIN wp_postmeta as product_weight ON product.ID = product_weight.post_ID | |
WHERE (product.post_type = 'product' OR product.post_type = 'product_variation') AND product_sku.meta_key = '_sku' AND product_price.meta_key = '_price' AND product_weight.meta_key = '_weight' | |
ORDER BY product_id ASC |
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
//Credit Reserved to : | |
//Abhijeet Chopra | |
//26 February 2016 | |
//URL : https://gist.github.com/abhijeetchopra/99a11fb6016a70287112 | |
//~~ Herman 18122018 | |
function makeCopy() { | |
//Time stamp generation. Storing variable in formatted date as days, dd-MM-YYY | |
const formattedDate = Utilities.formatDate(new Date(),"GMT+10:00", "EEE, d MMM yyyy"); |