Skip to content

Instantly share code, notes, and snippets.

View kilbot's full-sized avatar

Paul Kilmurray kilbot

View GitHub Profile
@kilbot
kilbot / receipt.php
Created December 21, 2024 12:07
Receipt template for WooCommerce POS Pro
<?php
/**
* Sales Receipt Template.
*
* This template can be overridden by copying it to yourtheme/woocommerce-pos/receipt.php.
* HOWEVER, this is not recommended , don't be surprised if your POS breaks
*/
if ( ! \defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
@kilbot
kilbot / payment.php
Created December 9, 2024 22:32
Custom payment.php template with integration for PW Gift Cards
<?php
/**
* POS Order Pay template.
*
* This template can be overridden by copying it to yourtheme/woocommerce-pos/payment.php.
* HOWEVER, this is not recommended , don't be surprised if your POS breaks
*/
defined( 'ABSPATH' ) || exit;
@kilbot
kilbot / PushOrdersJob.php
Created December 5, 2024 20:55
The code which handles pushing WooCommerce orders to the terminal
<?php
/**
* Poynt — a GoDaddy Brand for WooCommerce.
*
* @author GoDaddy
* @copyright Copyright (c) 2021 GoDaddy Operating Company, LLC. All Rights Reserved.
* @license GPL-2.0
*/
namespace GoDaddy\WooCommerce\Poynt\Sync\Jobs;
@kilbot
kilbot / functions.php
Last active November 22, 2024 14:38
Bypass status check for Vipps gateway
<?php
/**
* Add this to your theme's functions.php file.
*/
function validate_pos_order_status($has_status, $order, $status ) {
if (
/**
* Only applies if these conditions are met
* - Only check for requests coming from the POS.
* - Must have 'pos-open' status.
@kilbot
kilbot / functions.php
Last active August 23, 2024 12:59
Triggering the Lottery for WooCommerce plugin from the WC REST API
<?php
/**
* Add this to your theme's functions.php file.
*/
function wc_rest_create_ticket_on_placing_order($order, $request) {
if (class_exists('LTY_Order_Handler')) {
// Get the order ID
$order_id = $order->get_id();
@kilbot
kilbot / functions.php
Created July 31, 2024 15:36
Adding custom text to PDF Invoices & Packing Slips for WooCommerce
<?php
/**
* Add this to your theme's functions.php file to display text on the PDF template.
*
* Options for positioning the text:
* - wpo_wcpdf_before_document
* - wpo_wcpdf_before_shop_address
* - wpo_wcpdf_after_shop_address
* - wpo_wcpdf_before_shop_logo
@kilbot
kilbot / functions.php
Created July 3, 2024 20:29
WooCommerce Bottle Deposit Plugin REST API integration
<?php
/**
* Add this to your theme's functions.php file to save the bottle deposit on the order.
*/
function woocommerce_pos_save_order( $order, $request, $creating ) {
global $WooCommerce_Bottle_Deposit;
if ( isset( $WooCommerce_Bottle_Deposit ) && class_exists( 'WooCommerce_Bottle_Deposit_Admin' ) ) {
$wc_bottle_deposit_admin = new WooCommerce_Bottle_Deposit_Admin( $WooCommerce_Bottle_Deposit->get_plugin_name(), $WooCommerce_Bottle_Deposit->get_version() );
$wc_bottle_deposit_admin->handle_admin_orders( $order->get_id() );
@kilbot
kilbot / woocommerce-pos-gateways.php
Last active February 1, 2024 16:43
Simple plugin to add multiple gateways for WooCommerce POS Pro
<?php
/**
* Plugin Name: WooCommerce POS Gateways
* Plugin URI: https://wordpress.org/plugins/woocommerce-pos/
* Description: Extends WooCommerce with multiple POS gateways.
* Version: 1.0.0
* Author: kilbot
* Author URI: http://wcpos.com
* License: GPL-3.0+
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
@kilbot
kilbot / receipt.php
Created August 8, 2023 21:50
Custom receipt template with License Manager for WooCommerce
<?php
/**
* Sales Receipt Template
*
* This template can be overridden by copying it to yourtheme/woocommerce-pos/receipt.php.
* HOWEVER, this is not recommended , don't be surprised if your POS breaks
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
@kilbot
kilbot / functions.php
Created April 13, 2023 12:56
Changing default email template for POS orders
<?php
// This would go in your theme fucntions.php file, or you could create a new plugin
/**
* Change Email Subject and Heading
*/
function wc_custom_email_template_order_details( $order, $sent_to_admin, $plain_text, $email ) {
// If POS order, change the template
if ( $order->get_meta( '_pos' ) ) {
// Example: Change the email heading