Skip to content

Instantly share code, notes, and snippets.

View myalban's full-sized avatar
🤠
Available

Alban DOUSSAU de GUYONNET myalban

🤠
Available
View GitHub Profile
<?php
/*
This script will allow you to send a custom email from anywhere within wordpress
but using the woocommerce template so that your emails look the same.
Created by [email protected] on 27th of July 2017
Put the script below into a function or anywhere you want to send a custom email
*/
<?php
/*
Sometimes you need to do some kind of action to a custom post type after its saved.
In the case of this function my scenario is:
1. I have a custom post type registered called: clients
2. I want the url of their details page to be: /client-number-999/ (where 999 is the post_id - or client id)
Created by [email protected] on 16th of August 2017
@myalban
myalban / custom-woocommerce-shop-loop-thumbnail-and-title.php
Created September 4, 2020 21:22 — forked from ben-heath/custom-woocommerce-shop-loop-thumbnail-and-title.php
Custom WooCommerce Shop Loop Product Thumbnail and Title
<?php
/**
* Check if WooCommerce is active
**/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
// remove product thumbnail and title from the shop loop
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
@myalban
myalban / Calendar.vue
Created December 16, 2020 23:51 — forked from Nicklas2751/Calendar.vue
The vuetify event calendar example with typescript
<template>
<v-row class="fill-height">
<v-col>
<v-sheet height="64">
<v-toolbar flat color="white">
<v-btn outlined class="mr-4" color="grey darken-2" @click="setToday">Today</v-btn>
<v-btn fab text small color="grey darken-2" @click="prev">
<v-icon small>mdi-chevron-left</v-icon>
</v-btn>
<v-btn fab text small color="grey darken-2" @click="next">
@myalban
myalban / woocommerce-create-order.md
Created June 2, 2021 06:18 — forked from stormwild/woocommerce-create-order.md
WooCommerce Creating Order Programmatically

WooCommerce Creating Order Programmatically

WooCommerce Create Order

creating Woocommerce order with line_item programatically

// http://stackoverflow.com/questions/26581467/creating-woocommerce-order-with-line-item-programatically
$address = array(
            'first_name' => 'Fresher',
DELIMITER //
CREATE FUNCTION BIN_TO_UUID(bin BINARY(16))
RETURNS CHAR(36) DETERMINISTIC
BEGIN
DECLARE hex CHAR(32);
SET hex = HEX(bin);
RETURN LOWER(CONCAT(LEFT(hex, 8), '-', MID(hex, 9, 4), '-', MID(hex, 13, 4), '-', MID(hex, 17, 4), '-', RIGHT(hex, 12)));
END; //
DELIMITER //
CREATE FUNCTION UUID_TO_BIN(uuid CHAR(36))
RETURNS BINARY(16) DETERMINISTIC
RETURN UNHEX(CONCAT(REPLACE(uuid, '-', ''))); //
DELIMITER ;
@myalban
myalban / woocommerce-optimize-scripts.php
Created January 19, 2022 18:32 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@myalban
myalban / attributes-as-options.php
Created April 2, 2022 16:58 — forked from dazecoop/attributes-as-options.php
WooCommerce product attributes as selectable options without variations
<?php
/**
* List available attributes on product page in a drop-down selection
*/
add_action('woocommerce_before_add_to_cart_button', 'list_attributes_on_product_page');
function list_attributes_on_product_page() {
global $product;
$attributes = $product->get_attributes();
<?php
/**
* Adding the payment fragment to the WC order review AJAX response
*/
add_filter( 'woocommerce_update_order_review_fragments', 'my_custom_payment_fragment' );
/**
* Adding our payment gateways to the fragment #checkout_payments so that this HTML is replaced with the updated one.
*/
function my_custom_payment_fragment( $fragments ) {