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
/*********************************** | |
* This query is intended to retrieve all necessary | |
* columns to migrate to Recharge as described here: | |
* https://support.rechargepayments.com/hc/en-us/articles/360008683974-Migration-template-explained | |
************************************/ | |
SELECT | |
p.ID AS subscription_id, | |
oi.order_item_name AS external_product_name, |
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
5e94c20e0c7675cd693236944cb5a67e344ba9b6d6c0b456324ee4fed3f94af75ea532f98dcc9d5ddfbbd38a3abc997759fad8c57b4e5f993212b51866246ffe |
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 o.ID, fn.meta_value as first_name, ln.meta_value as last_name, | |
SUBSTRING_INDEX(SUBSTRING_INDEX(t.meta_value,';',9),':',-1) AS tracking | |
FROM `wp_posts` o | |
JOIN `wp_postmeta` t ON t.post_id = o.ID | |
JOIN `wp_postmeta` fn ON fn.post_id = o.ID | |
JOIN `wp_postmeta` ln ON ln.post_id = o.ID | |
WHERE | |
o.`post_type` = 'shop_order' | |
AND | |
t.`meta_key` = '_wc_shipment_tracking_items' |
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 | |
order_items.order_id, | |
posts.post_status, | |
max( | |
CASE | |
WHEN | |
pm.meta_key = '_shipping_first_name' | |
and order_items.order_id = pm.post_id | |
THEN | |
pm.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
SELECT o.ID AS order_id, oim.meta_value AS product_id, p.post_title AS product_name | |
FROM wp_woocommerce_order_itemmeta oim | |
JOIN wp_woocommerce_order_items oi ON oim.order_item_id = oi.order_item_id | |
JOIN wp_posts o ON oi.order_id = o.ID | |
JOIN wp_posts p ON oim.meta_value = p.ID | |
JOIN wp_postmeta pm ON p.ID = pm.post_id | |
WHERE oim.meta_key = '_product_id' | |
AND o.post_type = 'shop_subscription' | |
AND pm.meta_key = '_is_discontinued' | |
AND pm.meta_value = 'yes' |
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 | |
/** Post ID **/ | |
p.id, | |
/** Product Code **/ | |
mt.meta_value AS sku, | |
/** Product Stock **/ | |
m.meta_value AS stock, | |
/** Item Title **/ | |
p.post_title AS title, | |
/** Item Price **/ |
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
Verifying my Blockstack ID is secured with the address 142jtxEBrxXdDFKVYCZa949RoggN5sf82z https://explorer.blockstack.org/address/142jtxEBrxXdDFKVYCZa949RoggN5sf82z |
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 | |
sku, count(1) | |
FROM | |
wp_woocommerce_order_items oi, -- orders table | |
wp_posts p, -- woocommerce use posts to keep metadata on the order | |
wp_postmeta pm, -- we use this table to filter the completed orders | |
wp_postmeta pm1, -- we use this table again for getting the shipping country info | |
wp_woocommerce_order_itemmeta oim, -- use this table to get product ids from orders | |
(SELECT p.id as product_id, meta_value as sku FROM wp_posts p, wp_postmeta pm where | |
post_type='product' and post_status='publish' |
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_filter( 'pre_option_woocommerce_enable_guest_checkout', 'conditional_guest_checkout_based_on_product' ); | |
function conditional_guest_checkout_based_on_product( $value ) { | |
if ( WC()->cart ) { | |
$cart = WC()->cart->get_cart(); | |
foreach ( $cart as $item ) { | |
$product = $item['data']; | |
if(!empty($product) && $product->is_virtual()){ | |
$value = "no"; |
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 filter_woocommerce_login_redirect( $redirect, $user ) { | |
$new_redirect = (isset($_GET['redirect_to'])) ? $_GET['redirect_to'] : $redirect; | |
return $new_redirect; | |
}; | |
add_filter( 'woocommerce_login_redirect', 'filter_woocommerce_login_redirect', 10, 2 ); |
NewerOlder