Skip to content

Add "Buy one, get one" pricing and read currency from wcSettings#17

Merged
vbelolapotkov merged 1 commit into
update/plans-ui-canonical-parityfrom
update/plans-bogo-pricing
Jul 8, 2026
Merged

Add "Buy one, get one" pricing and read currency from wcSettings#17
vbelolapotkov merged 1 commit into
update/plans-ui-canonical-parityfrom
update/plans-bogo-pricing

Conversation

@vbelolapotkov

Copy link
Copy Markdown
Contributor

Why

The storewide plans manager should offer the free-tier BOGO ("buy one, get one") pricing type, matching the canonical WooCommerce Subscriptions plans UI. Separately, the client was duplicating the store's currency settings in a server payload when WooCommerce already exposes them client-side.

What

  • "Buy one, get one" pricing type. Now offered in the pricing-type select. BOGO is value-less (one free unit per purchased unit), so the amount input is hidden and replaced with a short help line; only the cycle scope (all / first / first N) applies. The discount descriptor writes a value-less { type: 'bogo' } policy on save, and the list column renders "Buy one, get one".
  • Currency from window.wcSettings. Currency is read from WooCommerce's own client-side settings (mapping symbolPosition to position and precision to decimals) instead of a duplicated server payload. The bundle depends on wc-settings; a USD fallback covers the global being absent.
  • Tests. JS unit tests for the bogo form round-trip and list rendering, plus a REST to DB round-trip integration test.

Merge order

The pricing type relies on the engine's new bogo PricingPolicy type landing via woocommerce/woocommerce#66379. CI resolves the engine from trunk, so the bogo REST round-trip test stays red until that engine change is on trunk. Draft, and do not merge before that engine PR lands.

Stacked on #16 (the parity pass); retarget to trunk after #16 merges.

- Offer BOGO in the pricing-type select; it is value-less, so the amount
  input is hidden with a help line and only the cycle scope applies
- Write the value-less bogo policy on save and render "Buy one, get one"
  in the plans list
- Source store currency from window.wcSettings (mapping symbolPosition and
  precision) instead of a duplicated server payload; depend on wc-settings
- Cover both with JS unit tests and a REST to DB round-trip integration test
@vbelolapotkov

Copy link
Copy Markdown
Contributor Author

Folding into #16 - this is part of the same plans-UI parity work, not a separate PR. The commit now lives on update/plans-ui-canonical-parity.

@vbelolapotkov vbelolapotkov merged commit 7f2bcb0 into update/plans-ui-canonical-parity Jul 8, 2026
1 of 2 checks passed
@vbelolapotkov vbelolapotkov deleted the update/plans-bogo-pricing branch July 8, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant