Skip to content

Instantly share code, notes, and snippets.

View kilbot's full-sized avatar

Paul Kilmurray kilbot

View GitHub Profile
@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
@kilbot
kilbot / tmpl-receipt.php
Last active January 19, 2023 10:33
Example of Pro receipt based on WooCommerce Print Invoices and Packing Lists
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php _e( 'Receipt', 'woocommerce-pos' ); ?></title>
<style type="text/css">
/* ==========*
* HTML TAGS *
@kilbot
kilbot / database.ts
Last active August 27, 2022 16:45
RxStorage adapter for expo-sqlite
import { createRxDatabase } from 'rxdb';
import { getRxStorageSQLite, SQLiteQueryWithParams } from 'rxdb-premium/plugins/sqlite';
import { openDatabase, WebSQLDatabase, ResultSet } from 'expo-sqlite';
/**
* Polyfill for TextEncoder
* fixes: ReferenceError: Can't find variable: TextEncoder
*/
import 'fast-text-encoding';
@kilbot
kilbot / functions.php
Created May 4, 2022 11:37
Deactivate Drip_Woocommerce_Cart_Events->find_drip_visitor_uuid()
<?php
// add to custom functions
add_filter( 'option_account_id', function( $value ){
if ( function_exists('is_pos') && is_pos() ) {
return null;
}
return $value;
});
@kilbot
kilbot / snippet.php
Last active February 15, 2022 22:31
Snippet to update order postmeta
<?php
global $wpdb;
$customer_id = 6; // CHANGE THIS!
$customer_email = 'test@wordpress.com'; // CHANGE THIS!
$postids = $wpdb->get_col(
$wpdb->prepare(
"
SELECT pm.post_id
FROM {$wpdb->postmeta} pm
@kilbot
kilbot / functions.php
Last active December 16, 2021 20:35
Bypass Advanced noCaptcha & invisible Captcha (v2 & v3)
<?php
// add to your theme functions.php file
function woocommerce_pos_anr_verify_captcha_pre($response) {
if( function_exists('is_pos') && is_pos() ) {
return true;
}
return $response;
}
@kilbot
kilbot / functions.php
Last active November 7, 2021 12:41
Support for PW Gift Cards plugin
<?php
// add to your theme functions.php file
function pw_gift_card_product_response($response) {
if( ! function_exists('is_pos') || ! is_pos() )
return $response;
$data = $response->get_data();
$type = isset( $data['type'] ) ? $data['type'] : '';
@kilbot
kilbot / functions
Created November 7, 2021 12:36
Support for PW Gift Cards plugin
<?php
// add to your theme functions.php file
function custom_product_response($response) {
if( ! function_exists('is_pos') || ! is_pos() )
return $response;
$data = $response->get_data();
$type = isset( $data['type'] ) ? $data['type'] : '';