Skip to content

Instantly share code, notes, and snippets.

View ValeriiVasyliev's full-sized avatar
🏄
Focusing

Valerii Vasyliev ValeriiVasyliev

🏄
Focusing
View GitHub Profile
@ValeriiVasyliev
ValeriiVasyliev / Woocommerce Javascript events.md
Last active January 7, 2025 12:26
Woocommerce Javascript events

Woocommerce Javascript events
Woocommerce Checkout JS events

$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
$( document.body ).trigger( 'applied_coupon_in_checkout' );
@ValeriiVasyliev
ValeriiVasyliev / edit-woocommerce-checkout-template.php
Created March 1, 2021 20:46 — forked from bekarice/edit-woocommerce-checkout-template.php
Add content and notices to the WooCommerce checkout - sample code
/**
* Each of these samples can be used - note that you should pick one rather than add them all.
*
* How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96
* Tutorial: http://www.skyverge.com/blog/edit-woocommerce-templates/
**/
/**
* Add a content block after all notices, such as the login and coupon notices.
*

MySQL script to get all WooCommerce orders including metadata

SET @date_start = '2021-02-12' ;
SELECT
    p.ID as order_id,
    MAX( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as name,
    MAX( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as lastname,
    MAX( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as email,
    MAX( CASE WHEN pm.meta_key = '_billing_phone' and p.ID = pm.post_id THEN pm.meta_value END ) as phone,
@ValeriiVasyliev
ValeriiVasyliev / .gitignore
Created January 13, 2021 21:43 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@ValeriiVasyliev
ValeriiVasyliev / README.md
Created January 13, 2021 21:43 — forked from developius/README.md
Setup SSH keys for use with GitHub/GitLab/BitBucket etc
@ValeriiVasyliev
ValeriiVasyliev / functions.php
Created December 23, 2020 16:11 — forked from mrwweb/functions.php
Example Child Theme Files
<?php
/*
Important!
Make sure to replace {my_} with your theme's unique prefix.
All future functions you write should use that same prefix.
Example: mrwnten_parent_theme_enqueue_styles()
*/
add_action( 'wp_enqueue_scripts', '{my_}parent_theme_enqueue_styles' );
@ValeriiVasyliev
ValeriiVasyliev / functions.php
Created December 15, 2020 20:26 — forked from jaredatch/functions.php
WordPress Search Autocomplete using admin-ajax.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@ValeriiVasyliev
ValeriiVasyliev / git-auto-deploy.md
Created November 29, 2020 12:54 — forked from yosukehasumi/git-auto-deploy.md
Setting Up Git-Auto-Deploy on Digital Ocean

Install software-properties-common

sudo apt-get install software-properties-common

Add Repo

sudo add-apt-repository ppa:olipo186/git-auto-deploy
@ValeriiVasyliev
ValeriiVasyliev / wordpress_terms_clauses_sorting.txt
Created October 17, 2020 19:16 — forked from ontiuk/wordpress_terms_clauses_sorting.txt
WordPress: Taxonomy Meta Sorting With Terms_Clauses Filter
add_filter( 'terms_clauses', 'filter_terms_clauses', 10, 3 );
/** 
* Filter WP_Term_Query meta query 
* @param   object  $query  WP_Term_Query 
* @return  object 
*/
function filter_terms_clauses( $pieces, $taxonomies, $args ) {
global $pagenow, $wpdb;    
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) {
echo 'This is the last post';
} ?>
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) {
echo 'This is the not the last post';
} ?>