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 | |
/* @var $args array */ | |
$tracking_actions = false; | |
if ( class_exists('WC_Shipment_Tracking_Actions') ) { | |
$tracking_actions = new \WC_Shipment_Tracking_Actions(); | |
} | |
if ( ! class_exists( 'TomShippingBob' ) ) { | |
include_once "../inc/classes/TomShippingBob.class.php"; | |
} |
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('gens_raf_coupon_amount', 'modify_raf_coupon_amount', 10, 2); | |
function modify_raf_coupon_amount($amount, $order_id) { | |
// Get the order object | |
$order = wc_get_order($order_id); | |
if (!$order) { | |
return $amount; // Return default amount if order not found |
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 | |
namespace WPGens_ST\Includes\WooCommerce; | |
use Automattic\WooCommerce\Utilities\OrderUtil; | |
defined('ABSPATH') || exit; | |
class WPGENS_ST_Orders_Analytics | |
{ |
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_action('woocommerce_checkout_order_processed', 'handle_partial_coupon_usage', 10, 3); | |
function handle_partial_coupon_usage($order_id, $posted_data, $order) { | |
$applied_coupons = $order->get_coupon_codes(); | |
// Ensure only one coupon is applied | |
if (count($applied_coupons) === 1) { | |
$coupon_code = current($applied_coupons); | |
$coupon = new WC_Coupon($coupon_code); |
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
import Fastify from "fastify"; | |
import WebSocket from "ws"; | |
import fs from "fs"; | |
import dotenv from "dotenv"; | |
import fastifyFormBody from "@fastify/formbody"; | |
import fastifyWs from "@fastify/websocket"; | |
// Load environment variables from .env file | |
dotenv.config(); | |
// Retrieve the OpenAI API key from environment variables. You must have OpenAI Realtime API access. | |
const { OPENAI_API_KEY } = process.env; |
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_action('woocommerce_checkout_order_processed', 'send_custom_order_email', 10, 1); | |
function send_custom_order_email($order_id) { | |
$order = wc_get_order($order_id); | |
$utm_source = get_post_meta($order_id, '_wpg_first_source', true); | |
// Only send email if utm_source exists and is an email address | |
if (!empty($utm_source) && filter_var($utm_source, FILTER_VALIDATE_EMAIL)) { |
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 | |
// Hook the function to the filter | |
add_filter('gens_raf_coupon_amount', 'modify_raf_coupon_amount', 10, 2); | |
function modify_raf_coupon_amount($amount, $order_id) { | |
// Get the user email from the order | |
$order = wc_get_order($order_id); | |
if (!$order) return $amount; | |
$rafID = get_post_meta($order_id,'_wpgens_raf_id',true); | |
if(!$rafID) { |
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 | |
/* TEMPORARY FEES INSTEAD OF COUPONS CODE */ | |
add_action('woocommerce_cart_calculate_fees', 'apply_10_percent_discount_as_fee'); | |
function apply_10_percent_discount_as_fee($cart) { | |
// Avoid applying the fee in the admin or if cart is empty | |
if (is_admin() || !WC()->cart->get_cart_contents_count()) { | |
return; | |
} |
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
<table style="border-collapse: collapse; font-family: Arial; width: 100%;" cellspacing="0" cellpadding="0"> | |
<tbody> | |
<tr> | |
<td style="padding: 0px;"> | |
<table cellspacing="0" cellpadding="0"> | |
<tbody> | |
<tr> | |
<td style="text-align: left; padding-top: 10px; padding-bottom: 20px;"> | |
<p style="font-size: 14px; margin: 0;">Michael Baum</p> | |
<p style="font-size: 14px; margin: 0;">Founder and CEO</p> |
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
import { google } from "googleapis"; | |
import { Readable } from "stream"; | |
import { NextResponse } from "next/server"; | |
import { Client } from "@notionhq/client"; | |
let auth; | |
let drive; | |
const notion = new Client({ auth: process.env.NOTION_API_KEY }); |