Skip to content

Instantly share code, notes, and snippets.

@ndeet
ndeet / woocommerce-using-btc-but-showing-sats.md
Last active September 12, 2022 20:34
How to use Sats only on WooCommerce with BTCPay Server

This is a way to Sats prices on your WooCommerce (WC) store products by using BTC (Bitcoin) currency that gets shipped with WC. It does still show BTC on checkout pages and on the backend.

So internally WC will use BTC and you need to enter amounts in BTC, e.g. 0.00002100 but on the frontend for product pages it will show 2100 Sats

1. You need to switch your store to use BTC / Bitcoin

Navigate to WC settings: WooCommerce -> Settings -> General (tab): "Currency options" Currency: select Bitcoin (B) Currency position: select Right with space Thousand separator: enter what you prefer ,, or . or sth else

@ndeet
ndeet / functions.php
Last active June 1, 2022 22:25
Output BTC as Sats value for WOOCS (WooCommerce Currency Switcher)
// Assumption is that you fetch the correct Bitcoin exchange rates for the currency code ($currencyCode) "BTC".
// Adjust accordingly in the code below if you use a different one.
// On WOOCS settings you can add a custom symbol for "Sats" and display it accordingly.
// Use WOOCS currency data manipulation filter to adjust rate and decimals.
add_filter('woocs_currency_data_manipulation', 'my_woocs_currency_data_manipulation', 1, 1);
function my_woocs_currency_data_manipulation($currencies)
@ndeet
ndeet / workaround-btcpay-woocommerce-outdated-openssl.md
Created December 23, 2021 19:46
BTCPay for WooCommerce plugin: with outdated openssl versions < 1.1.0

IMPORTANT: these changes will get wiped and overwritten with each BTCPay for WooCommerce plugin update and the proper way to fix this would be that your server (or your hosting provider) updates to a more recent OpenSSL version.

go to the plugins dircetory e.g. wp-content/plugins/btcpay-for-woocommerce

there find the certificate bundle in the library and open it:

nano lib/Bitpay/Client/Adapter/ca-bundle.crt

  1. search for "DST Root CA X3"
@ndeet
ndeet / nginx-reverseproxy-ip2tor.md
Last active December 13, 2021 07:53
Setup Nginx + Lets Encrypt reverse proxy for BTCPay over IP2TOR (raspiblitz)

Tested on Ubuntu 20.04 minimal install

Preparation: Setup a VPS and not down the IP 21.21.21.21 (replace with real IP) Add a subdomain and map it to the VPS IP via an A-Record to 21.21.21.21

Replace btcpay.yourdomain.tld with your actual subdomain.

SSH into your VPS and follow the steps:

Keybase proof

I hereby claim:

  • I am ndeet on github.
  • I am ndeet (https://keybase.io/ndeet) on keybase.
  • I have a public key ASC_PczXd53EPNCRXoo1MtcNZsCfZ6w7CzcdCW5VMauCogo

To claim this, I am signing this object:

@ndeet
ndeet / view-orderaddress.yml
Created June 28, 2018 11:34
Drupal Commerce 2 view with relationships to output each address component as field
uuid: 7074647f-9a97-4aba-a672-3e60beac3f3a
langcode: en
status: true
dependencies:
module:
- address
- commerce_order
- profile
- user
id: orderadress
@ndeet
ndeet / MYTHEME.info
Last active February 8, 2018 14:41
Drupal 7, Panels 3.3+ Pane Style Plugin
; Register Style Plugin directory
plugins[panels][styles] = panels/styles