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 | |
// Adtraction conversion tracking implementation | |
add_action( 'woocommerce_thankyou', 'adtraction_tracking', 60 ); | |
function adtraction_tracking( $order_id ) { | |
$order = new WC_Order( $order_id ); | |
$order_nr = $order->get_order_number(); | |
$order_total_shipping = $order->get_total_shipping(); | |
$order_total_ex_vat = $order->get_total() - $order->get_total_tax(); | |
$order_total = $order_total_ex_vat - $order_total_shipping; | |
$order_email = get_user_meta( $order->user_id, 'billing_email', true ); |
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 | |
/* ADD GTM TO HEAD AND BELOW OPENING BODY */ | |
add_action('wp_head', 'google_tag_manager_head', 20); | |
function google_tag_manager_head() { ?> | |
<!-- Google Tag Manager --> | |
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); |
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
// Edit order items table template defaults | |
function sww_add_wc_order_email_images( $table, $order ) { | |
ob_start(); | |
$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php'; | |
wc_get_template( $template, array( | |
'order' => $order, | |
'items' => $order->get_items(), | |
'show_download_links' => $show_download_links, |
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 | |
add_filter( 'woocommerce_email_attachments', 'attach_terms_conditions_pdf_to_email', 10, 3); | |
function attach_terms_conditions_pdf_to_email ( $attachments , $id, $object ) { | |
$your_pdf_path = get_template_directory() . '/terms.pdf'; | |
$attachments[] = $your_pdf_path; | |
return $attachments; | |
} |
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
/** | |
* Adding Custom GTIN Meta Field | |
* Save meta data to DB | |
*/ | |
// add GTIN input field | |
add_action('woocommerce_product_options_inventory_product_data','woocom_simple_product_gtin_field', 10, 1 ); | |
function woocom_simple_product_gtin_field(){ | |
global $woocommerce, $post; | |
$product = new WC_Product(get_the_ID()); | |
echo '<div id="gtin_attr" class="options_group">'; |
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 | |
/* | |
Woocommerce additional product identifier fields | |
Add 4 important product identifiers Brand, MPN, UPC, EAN, GTIN to simple and variabel products required for sales channels | |
*/ | |
// Simple Product Hooks | |
// Display Fields | |
add_action( 'woocommerce_product_options_general_product_data', 'wpmr_custom_general_fields' ); |
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
{ | |
"name": "example", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"directories": { | |
"lib": "lib" | |
}, | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", |
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
const { src, dest, parallel, series, watch } = require('gulp'); | |
const concat = require('gulp-concat'); | |
const sass = require('gulp-sass')(require('sass')); | |
const cleanCSS = require('gulp-clean-css'); | |
const uglify = require('gulp-uglify-es').default; | |
const sourcemaps = require('gulp-sourcemaps'); | |
const livereload = require('gulp-livereload'); | |
const postcss = require("gulp-postcss"); | |
const autoprefixer = require("autoprefixer"); | |
const cssnano = require("cssnano"); |
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
add_action( 'woocommerce_email_after_order_table', 'add_trustpilot_afs_tracking', 20, 2 ); | |
function add_trustpilot_afs_tracking( $order, $sent_to_admin ) { | |
if ( ! $sent_to_admin ) { | |
?> | |
<script type="application/json+trustpilot"> | |
{ | |
"recipientEmail": "<?php echo $order->billing_email; ?>", | |
"recipientName": "<?php echo $order->billing_first_name.' '. $order->billing_last_name; ?>", | |
"referenceId": "<?php echo $order->get_order_number(); ?>", | |
"products": [<?php |
NewerOlder