← All extensions

WooCommerce Snippets

v0.1.0 · by Renzo Johnson · added 3 November 2026

180 curated WooCommerce snippets — hooks, CRUD, HPOS, Block Checkout, REST API, and more

Snippets

How to install

With Forge Super installed, the button above opens the app on this extension, where you press Install. Nothing is installed until you do.

You can also open the Extensions panel in the app and search for WooCommerce Snippets. The extension's id is woocommerce-snippets.

Don't have Forge Super yet? Download it here.

README

From the extension's repository, written by its authors and not by Mentenaz. See the source.

WooCommerce Snippets for Zed

180 curated WooCommerce code snippets for Zed. Not static text dumps — these are smart snippets that use Zed's modern snippet engine to its full potential.

Author: Renzo Johnson

Why This Extension Is Different

Most snippet packs paste dead text. This one writes code with you:

Choice Dropdowns — Pick from a Menu, Don't Type from Memory

Type wc:rest:endpoint and tab to the HTTP method — a dropdown menu appears with GET, POST, PUT, PATCH, DELETE. No typos. No docs lookup. Just pick.

'methods' => '${GET|POST|PUT|PATCH|DELETE}' ← dropdown menu, not a text field

25 snippets have choice dropdowns for: HTTP methods, capabilities, field types, order statuses, product types, log levels, conditional functions, and more.

Linked Placeholders — Type Once, Fills Everywhere

Type wc:checkout:gateway — enter your textdomain once and it auto-fills in 6 locations across the entire payment gateway scaffold. Change it once, all 6 update instantly.

// You type "my-shop" once in $4, and it fills everywhere:
$this->title       = __( 'Pay on Delivery', 'my-shop' );    // ← auto
$this->description = __( 'Pay when received', 'my-shop' );  // ← auto
$this->method_title = __( 'Pay on Delivery', 'my-shop' );   // ← auto
// ... 6 locations, one keystroke

31 snippets use linked placeholders — textdomains, callback names, slugs, class names, hook names all stay in sync.

Smart Defaults — Expand and Run Immediately

Every snippet is pre-filled with the most common real-world value. Expand wc:create:order and the code runs as-is — then customize. No placeholder gibberish like ENTER_VALUE_HERE.

Modern WooCommerce — Not Your 2019 Snippet Pack

HPOS-compatible order queries. Block Checkout fields. Store API extensions. Action Scheduler patterns. Feature flag checks. If WooCommerce shipped it in the last 2 years, there's a snippet for it.

Install

Option A — Extension Gallery:

  1. Open Zed
  2. Cmd+Shift+X (macOS) or Ctrl+Shift+X (Linux) to open Extensions
  3. Search "WooCommerce"
  4. Click Install

Option B — Command Palette:

  1. Cmd+Shift+P → "zed: extensions"
  2. Search "WooCommerce Snippets"
  3. Click Install

Usage

Type wc: in any .php file and browse all 180 snippets. Use the category prefix to filter:

wc:action:     → Action hooks (30)
wc:filter:     → Filter hooks (30)
wc:checkout:   → Checkout (8)
wc:rest:       → REST API (8)
wc:is:         → Conditionals (12)
wc:hpos:       → HPOS (6)
wc:blocks:     → Blocks (5)

Snippet Reference

Hooks — Actions (30)

PrefixDescription
wc:action:add_to_cartAfter item added to cart
wc:action:after_shop_loopAfter product archive loop
wc:action:after_shop_loop_itemAfter each product in loop
wc:action:after_single_productAfter single product page
wc:action:before_calculate_totalsBefore cart totals calculate
wc:action:before_cartBefore cart page content
wc:action:before_shop_loopBefore product archive loop
wc:action:before_shop_loop_itemBefore each product in loop
wc:action:before_single_productBefore single product page
wc:action:cart_emptiedAfter cart is emptied
wc:action:cart_updatedAfter cart quantities update
wc:action:check_cart_itemsValidate cart contents
wc:action:checkout_create_orderDuring order creation
wc:action:checkout_order_processedAfter checkout creates order
wc:action:checkout_processValidate during checkout submit
wc:action:checkout_update_order_metaSave custom checkout data
wc:action:initHook into WooCommerce init
wc:action:loadedHook after WooCommerce loads
wc:action:new_orderWhen new order is created
wc:action:order_refundedWhen order is refunded
wc:action:order_statusSpecific order status transition
wc:action:order_status_changedWhen order status changes
wc:action:payment_completeAfter payment completes
wc:action:process_product_metaAdmin product save (legacy)
wc:action:process_product_objectAdmin product save (modern)
wc:action:register_post_typeAfter WC post types register
wc:action:register_taxonomyAfter WC taxonomies register
wc:action:single_product_summarySingle product summary area
wc:action:thankyouThank you page content
wc:action:update_optionsAfter WC settings saved

Hooks — Filters (30)

PrefixDescription
wc:filter:add_to_cart_textChange add to cart button text
wc:filter:add_to_cart_urlChange add to cart URL
wc:filter:add_to_cart_validationValidate add to cart
wc:filter:available_gatewaysFilter payment gateways
wc:filter:billing_fieldsModify billing fields
wc:filter:calculated_totalModify cart calculated total
wc:filter:cart_item_nameModify cart item name
wc:filter:cart_item_priceModify cart item price display
wc:filter:cart_item_quantityModify cart quantity input
wc:filter:cart_item_thumbnailModify cart item thumbnail
wc:filter:checkout_fieldsModify all checkout fields
wc:filter:countriesFilter allowed countries
wc:filter:currencyChange store currency
wc:filter:default_address_fieldsModify default address fields
wc:filter:email_attachmentsAdd email attachments
wc:filter:email_headersModify email headers
wc:filter:email_recipientModify email recipient
wc:filter:locate_templateOverride template location
wc:filter:order_item_nameModify order item name
wc:filter:order_numberModify displayed order number
wc:filter:payment_complete_statusChange status after payment
wc:filter:priceModify product price
wc:filter:price_htmlModify price HTML display
wc:filter:product_data_tabsAdmin product data tabs
wc:filter:product_tabsAdd/remove product tabs
wc:filter:product_visibleControl product visibility
wc:filter:regular_priceModify regular price
wc:filter:sale_priceModify sale price
wc:filter:shipping_fieldsModify shipping fields
wc:filter:short_descriptionModify product short description

CRUD (15)

PrefixDescription
wc:coupon:createCreate coupon programmatically
wc:create:orderCreate order programmatically
wc:create:productCreate simple product
wc:get:customerGet customer by user ID
wc:get:orderGet order by ID
wc:get:ordersQuery multiple orders
wc:get:productGet product by ID
wc:get:productsQuery multiple products
wc:order:itemsLoop through order items
wc:order:noteAdd note to order
wc:order:statusUpdate order status
wc:product:variationsGet product variations
wc:refund:createCreate refund for order
wc:update:order_metaUpdate order meta data
wc:update:product_metaUpdate product meta data

Checkout (8)

PrefixDescription
wc:checkout:fieldAdd custom checkout field
wc:checkout:gatewayPayment gateway scaffold
wc:checkout:order_reviewModify order review
wc:checkout:redirectCustom thank you redirect
wc:checkout:remove_fieldRemove checkout field
wc:checkout:reorderReorder checkout fields
wc:checkout:saveSave checkout field to order
wc:checkout:validateValidate checkout field

REST API (8)

PrefixDescription
wc:rest:authREST authentication check
wc:rest:endpointCustom REST endpoint scaffold
wc:rest:extendExtend WC REST response
wc:rest:getGET endpoint with parameters
wc:rest:postPOST endpoint with validation
wc:rest:requestInternal WC REST request
wc:rest:schemaREST schema definition
wc:rest:webhookRegister custom webhook topic

Conditionals (13)

PrefixDescription
wc:ifConditional check (choice of function)
wc:is:accountCheck if account page
wc:is:ajaxCheck if WC AJAX request
wc:is:cartCheck if cart page
wc:is:categoryCheck if product category
wc:is:checkoutCheck if checkout page
wc:is:hposCheck if HPOS is enabled
wc:is:order_receivedCheck if thank you page
wc:is:productCheck if single product
wc:is:restCheck if WC REST request
wc:is:shopCheck if shop page
wc:is:tagCheck if product tag
wc:is:woocommerceCheck if any WC page

Admin (8)

PrefixDescription
wc:admin:bulk_actionOrders bulk action
wc:admin:columnCustom orders list column
wc:admin:noticeWC-style admin notice
wc:admin:order_meta_boxOrder edit meta box
wc:admin:product_panelProduct options panel fields
wc:admin:product_tabCustom product data tab
wc:admin:settings_fieldAdd WC settings field
wc:admin:settings_pageWC settings page scaffold

Cart (8)

PrefixDescription
wc:cart:addAdd item to cart
wc:cart:couponApply coupon to cart
wc:cart:emptyEmpty the cart
wc:cart:feeAdd custom fee to cart
wc:cart:itemsLoop through cart items
wc:cart:sessionGet/set cart session data
wc:cart:shippingGet chosen shipping method
wc:cart:totalGet cart totals

Blocks (5)

PrefixDescription
wc:blocks:checkout_fieldBlock checkout custom field
wc:blocks:extendExtend Store API schema
wc:blocks:inner_blockRegister checkout inner block
wc:blocks:integrationRegister block integration
wc:blocks:store_apiCustom Store API endpoint

Emails (5)

PrefixDescription
wc:email:classCustom email class scaffold
wc:email:contentEmail body with template
wc:email:registerRegister email with WC
wc:email:templateOverride email template
wc:email:triggerTrigger WC email

HPOS (6)

PrefixDescription
wc:hpos:checkCheck if HPOS is active
wc:hpos:custom_tableExtend HPOS custom tables
wc:hpos:declareDeclare HPOS compatibility
wc:hpos:metaHPOS-safe order meta
wc:hpos:orderHPOS-safe order retrieval
wc:hpos:queryHPOS-compatible order query

Queries (10)

PrefixDescription
wc:query:by_dateOrders by date range
wc:query:by_metaProducts by custom meta
wc:query:categoriesQuery product categories
wc:query:couponsQuery coupons
wc:query:customersQuery WooCommerce customers
wc:query:order_queryWC_Order_Query object
wc:query:ordersAdvanced order query
wc:query:product_queryWC_Product_Query object
wc:query:productsAdvanced product query
wc:query:subscriptionsQuery WC Subscriptions

Notices & Logging (7)

PrefixDescription
wc:logLogger (choice of log level)
wc:log:errorLog error to WC logger
wc:log:infoLog info to WC logger
wc:noticeNotice (choice: error/success/notice)
wc:notice:errorAdd error notice
wc:notice:infoAdd info notice
wc:notice:successAdd success notice

Scheduler (5)

PrefixDescription
wc:cronWP-Cron with Action Scheduler
wc:scheduler:callbackAction callback handler
wc:scheduler:recurringSchedule recurring action
wc:scheduler:searchSearch scheduled actions
wc:scheduler:singleSchedule single action

Security (4)

PrefixDescription
wc:cap:checkCapability check
wc:nonce:verifyNonce verification
wc:sanitize:orderSanitize order data
wc:validate:productValidate product data

Shipping (6)

PrefixDescription
wc:shipping:calculateCalculate shipping rates
wc:shipping:freeFree shipping threshold
wc:shipping:hideHide shipping methods conditionally
wc:shipping:methodShipping method class scaffold
wc:shipping:registerRegister shipping method
wc:shipping:zoneGet shipping zones

Templates (6)

PrefixDescription
wc:template:afterAdd content after template
wc:template:beforeAdd content before template
wc:template:locateLocate template with custom path
wc:template:overrideOverride WC template in theme
wc:template:partLoad WC template part
wc:template:removeRemove template hook callback

Utilities (6)

PrefixDescription
wc:ajaxAJAX endpoint scaffold
wc:featureFeature flag check
wc:hookGeneric hook (action or filter)
wc:metaOrder meta operations
wc:wrap:actionWrap in add_action
wc:wrap:filterWrap in add_filter

Prefix Convention

All snippets start with wc: followed by the category:

PrefixCategoryCount
wc:action:*Action hooks30
wc:filter:*Filter hooks30
wc:create:* wc:get:* wc:order:* wc:update:*CRUD operations15
wc:checkout:*Checkout8
wc:rest:*REST API8
wc:is:* wc:ifConditionals13
wc:admin:*Admin8
wc:cart:*Cart8
wc:blocks:*Block Checkout / Store API5
wc:email:*Emails5
wc:hpos:*HPOS6
wc:query:*Queries10
wc:notice:* wc:log:*Notices & Logging7
wc:scheduler:* wc:cronAction Scheduler5
wc:cap:* wc:nonce:* wc:sanitize:* wc:validate:*Security4
wc:shipping:*Shipping6
wc:template:*Templates6
wc:ajax wc:hook wc:meta wc:feature wc:wrap:*Utilities6

Requirements

License

MIT License. Copyright (c) 2026 Renzo Johnson.