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 ALL USERS WITH NO BILLING FIRST NAME IN WOOCOMMERCE | |
SELECT * | |
FROM wp_users AS wpu | |
INNER JOIN wp_usermeta wpum | |
ON wpum.user_id = wpu.ID | |
WHERE wpu.ID IN ( | |
SELECT wp_users.ID | |
FROM wp_users |
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
# GET ALL WOOCOMMERCE PRODUCTS BY CATEGORY ID (124) | |
SELECT ID, post_title | |
FROM wp_posts | |
INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) | |
INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) | |
WHERE wp_term_taxonomy.term_id IN(124) | |
GROUP BY 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 | |
$json = file_get_contents("php://input"); | |
$data = (array) json_decode($json, true); | |
if ( array_key_exists('name', $data) ) { | |
$name = (string) $data['name']; | |
$value = (int) $data['value']; | |
$text = (string) $data['text']; | |
} |
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 ON CHANGE VALUES FETCHING TO PHP | |
document.querySelectorAll(`select.collect`).forEach(dropdown => | |
dropdown.addEventListener(`change`, (e) => { | |
// GET VALUES | |
let value = e.target.value; | |
let text = dropdown.options[dropdown.selectedIndex].text; | |
let price = dropdown.options[dropdown.selectedIndex].getAttribute(`attr-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
# Delete all WooCommerce orders, order_meta and order post_meta datas | |
DELETE FROM wp_woocommerce_order_itemmeta; | |
DELETE FROM wp_woocommerce_order_items; | |
DELETE FROM wp_comments WHERE comment_type = 'order_note'; | |
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' ); | |
DELETE FROM wp_posts WHERE post_type = 'shop_order'; |
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 code should be include in functions.php | |
*/ | |
/* Custom 'super-editor' user role (ID, not label) */ | |
// This is the name of custom user role, you can change to anything, but this role should be exists | |
// You can add any custom user role eg. with Vladimir Garagulya User Role Editor plugin | |
if (current_user_can( 'super-editor' )) { |
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
// Phone number restriction for input_10_4 field | |
// Start with + character | |
$('#input_10_4').val('+'); | |
$('#input_10_4').attr('data-initial', '+'); | |
// Cannot delete the + character | |
$("#input_10_4").on("keyup", 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
// Put functions.php | |
add_filter('give_format_amount', 'give_remove_thousands_seperator'); | |
function give_remove_thousands_seperator($amount, $decimals = true) { | |
$thousands_sep = ''; | |
$decimal_sep = give_get_option( 'decimal_separator', '.' ); | |
if ( empty( $amount ) ) { |
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 | |
/* Custom woocommerce loop and add to isotope container */ | |
// Display woo products order by price | |
$args=array( | |
'post_type' => 'product', | |
'post_status' => 'publish', | |
'orderby' => 'meta_value_num', | |
'meta_key' => '_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
<?php | |
//Set minimum order amount | |
function minimum_order_func(){ | |
global $woocommerce; | |
if (is_checkout()){ | |
$minorder = 1500; | |
// If the cart is empty and the order_total less than $minorder (1500) |
NewerOlder