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 p.`ID` AS 'Product ID', | |
p.`post_title` AS 'Product Name', | |
t.`term_id` AS 'Attribute Value ID', | |
REPLACE(REPLACE(tt.`taxonomy`, 'pa_', ''), '-', ' ') AS 'Attribute Name', | |
t.`name` AS 'Attribute Value' | |
FROM `wp_posts` AS p | |
INNER JOIN `wp_term_relationships` AS tr ON p.`ID` = tr.`object_id` | |
INNER JOIN `wp_term_taxonomy` AS tt ON tr.`term_taxonomy_id` = tt.`term_id` | |
AND tt.`taxonomy` LIKE 'pa_%' | |
INNER JOIN `wp_terms` AS t ON tr.`term_taxonomy_id` = t.`term_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
<?php | |
//Displaying Additional Columns | |
add_filter( 'manage_edit-product_cat_columns', 'wh_customFieldsListTitle' ); //Register Function | |
add_action( 'manage_product_cat_custom_column', 'wh_customFieldsListDisplay' , 10, 3); //Populating the Columns | |
/** | |
* Meta Title and Description column added to category admin screen. | |
* | |
* @param mixed $columns |
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 p.`ID`, | |
p.`post_title` AS coupon_code, | |
p.`post_excerpt` AS coupon_description, | |
Max(CASE WHEN pm.meta_key = 'discount_type' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS discount_type, -- Discount type | |
Max(CASE WHEN pm.meta_key = 'coupon_amount' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS coupon_amount, -- Coupon amount | |
Max(CASE WHEN pm.meta_key = 'free_shipping' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS free_shipping, -- Allow free shipping | |
Max(CASE WHEN pm.meta_key = 'expiry_date' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS expiry_date, -- Coupon expiry date | |
Max(CASE WHEN pm.meta_key = 'minimum_amount' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS minimum_amount, -- Minimum spend | |
Max(CASE WHEN pm.meta_key = 'maximum_amount' AND p.`ID` = pm.`post_id` THEN pm.`meta_value` END) AS maximum_amount, -- Maximum spend | |
Max(CASE WHEN pm.m |
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
[ | |
{ | |
"keys": ["ctrl+alt+c"], | |
"command": "copy_path" | |
}, | |
{ | |
"keys": ["shift+command+m"], | |
"command": "goto_definition" | |
}, | |
{ |
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 | |
$order_id = method_exists($order, 'get_id') ? $order->get_id() : $order->id; | |
//getting shipping details | |
$tracking_number = get_post_meta($order_id, '_tracking_number', TRUE); | |
if (isset($tracking_number) && !empty($tracking_number)) { | |
$order_data['shipping_details'] = array( | |
'tracking_provider' => get_post_meta($order_id, '_tracking_provider', TRUE), | |
'tracking_number' => $tracking_number, |
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 | |
$order_id = method_exists($order, 'get_id') ? $order->get_id() : $order->id; | |
//getting shipping details | |
$objWC_Shipment = WC_Shipment_Tracking_Actions::get_instance(); | |
$shipping_details = $objWC_Shipment->get_tracking_items($order_id); | |
if (!empty($shipping_details)) { | |
foreach ($shipping_details as $shipping_detail) { | |
$order_data['shipping_details'][] = array( |
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 | |
$order_detail = getOrderDetailById(101); //to get the detail of order ID #101 | |
print_r($order_detail); |
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 (!function_exists('getOrderDetailById')) { | |
function getOrderDetailById($id, $fields = null, $filter = array()) { | |
if (is_wp_error($id)) | |
return $id; | |
// Get the decimal precession |
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 (!function_exists('getOrderDetailById')) { | |
//to get full order details | |
function getOrderDetailById($id, $fields = null, $filter = array()) { | |
if (is_wp_error($id)) | |
return false; |
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 | |
//create an instance of your model | |
$objMyModel = new MyModel(); | |
//query for fetching data | |
$data = $objMyModel->setConnection('mysql_second') | |
->select('col_1') | |
->get(); |
NewerOlder