Skip to content

Instantly share code, notes, and snippets.

View lmacchiavelli's full-sized avatar
🐍
This emoji is me

Lorenzo Macchiavelli lmacchiavelli

🐍
This emoji is me
View GitHub Profile
1. You have access to $order variable
Hooks (do_action and apply_filters) use additional arguments which are passed on to the function. If they allow you to use the “$order” object you’re in business. Here’s how to get all the order information:
// Get Order ID and Key
$order->get_id();
$order->get_order_key();
// Get Order Totals $0.00
$order->get_formatted_order_total();
$order->get_cart_tax();
$cart = WC()->cart;
// $cart conditionals (if)
WC()->cart->is_empty()
WC()->cart->needs_payment()
WC()->cart->show_shipping()
WC()->cart->needs_shipping()
WC()->cart->needs_shipping_address()
WC()->cart->display_prices_including_tax()
@lmacchiavelli
lmacchiavelli / incolla-immagine.py
Created July 10, 2020 14:06
Incollare un immagine sopra uno sfondo con PIL
from PIL import Image, ImageDraw
background = Image.open("immagine-di-background.png" )
immagine-da-incollare-sopra = Image.open('img/elementi/layoutB.png')
width, height = background.size
transparent = Image.new('RGBA', (width, height), (0,0,0,0))
transparent.paste(background, (0,0))
transparent.paste(immagine-da-incollare-sopra, (0,0))
background.save('immagine-da-salvare.png')
#Importiamo le librerie
import os
from InstagramAPI import InstagramAPI
import time
import schedule
#Importo l'elenco dei file presenti nella cartella coda_file in una lista
foldername = './coda_file/'
fileNames = os.listdir(foldername)