The La Marie Beauty (LMB) website requires a custom payment flow to handle a mixed cart containing both products and services. Neither WooCommerce nor Bookly supports this split-payment behavior out of the box — a custom PHP solution is required, integrated with Square's APIs for secure card tokenization.
This pattern is relevant to any WordPress/WooCommerce project that needs to differentiate payment behavior by item type at checkout.
LMB's cart must support three purchase scenarios simultaneously:
| Cart Contents | Payment Behavior |
|---|---|
| Products only | Charged in full at checkout |
| Services only | Card held on file; charged post-service or for no-show/cancellation penalties |
| Mixed (products + services) | Products charged immediately; services card-on-file only |
Standard WooCommerce checkout treats all items identically. Bookly's payment handling does not natively support card-on-file holds. Neither plugin alone can express this split logic.
WordPress and WooCommerce expose a hook system that allows custom PHP to intercept and modify checkout behavior. The payment logic is implemented by hooking into these extension points rather than modifying core plugin files.
Why PHP (not JavaScript)?
- WordPress's backend is PHP-based
- WooCommerce hooks are PHP-only
- Backend payment processing must happen server-side for security
JavaScript is used separately for frontend UI (see [1]), but payment logic lives in PHP.
Rather than building fully custom card storage, the solution leverages Square's existing APIs for:
Isahaque (PHP developer) confirmed he can create the Square API key directly and implement this integration.
Customer Checkout
│
├─ Product in cart? ──► WooCommerce standard charge (full amount, immediate)
│
└─ Service in cart? ──► Custom PHP hook
│
└─ Square API: tokenize card, store on file
│
├─ No-show/cancellation: charge penalty
└─ Post-service: charge full service amount