Skip to content

Instantly share code, notes, and snippets.

View kilbot's full-sized avatar

Paul Kilmurray kilbot

View GitHub Profile
@kilbot
kilbot / 2026-07-10-receipt-savings-convenience-fields.md
Last active July 10, 2026 19:16
WCPOS receipt savings convenience fields implementation plan

Receipt Savings Convenience Fields Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Add an additive, merchant-friendly line-item pricing layer to Receipt Data v1 so receipts can show the recorded regular price, pre-coupon selling price, and customer savings without changing existing WooCommerce discount fields.

Architecture: Receipt_Data_Builder remains the live source of truth and derives the new values from _woocommerce_pos_data. Receipt_Data_Schema publishes and formats the fields, while Preview_Receipt_Builder and JSON fixtures provide equivalent preview data. Price-bearing bundled templates render savings conditionally; existing discounts fields and coupon rows remain untouched.

Tech Stack: PHP 8+, WordPress, WooCommerce order-item APIs, Mustache/logicless HTML templates, thermal

@kilbot
kilbot / wcpos-price-savings-research.md
Created July 10, 2026 16:35
WCPOS receipt price and savings semantics research

WCPOS receipt price and savings semantics

Research asset for Establish price and savings semantics, part of Map: Restore POS price-reduction visibility in receipts.

Executive conclusion

Observed: For WCPOS 1.8.11 through 1.9.x, _woocommerce_pos_data.price and _woocommerce_pos_data.regular_price are the only stable order-line snapshots that preserve the pre-coupon selling price and the recorded regular/reference price. The current catalog product must not be used as a historical fallback.

Observed: Since 1.9.0, the stored WooCommerce line subtotal equals the WCPOS selling price. Consequently, subtotal - total and WooCommerce discount_total represent coupon discount only. This is intentional WooCommerce sale-price parity, not missing order data. WCPOS v1.9 documentation, [server PR with design intent](https://gi

@kilbot
kilbot / functions.php
Created June 5, 2025 15:43
Migrate POS orders from Actuality Extensions
<?php
function wcpos_update_created_via_field() {
$batch_size = 100;
$page = 1;
do {
$orders = wc_get_orders( [
'limit' => $batch_size,
'page' => $page,
@kilbot
kilbot / functions.php
Created May 5, 2025 16:59
Force TaxJar to use POS store shipping address
<?php
// add to your functions.php file
function apply_pos_forced_shipping_address( $order, $request, $creating ) {
// only apply on order creation
if ( ! $creating ) {
return $order;
}
// only apply for POS orders
@kilbot
kilbot / functions.php
Last active April 3, 2025 15:44
Example custom product response for POS Stores
<?php
/**
* add to your theme functions.php file
*/
function my_custom_product_response( $response, $product, $request ) {
// only intercept requests from the POS
if( ! function_exists('woocommerce_pos_request') || ! woocommerce_pos_request() )
return $response;
$store_id = $request->get_param( 'store_id' );
@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();