A lightweight Visual Studio Code extension providing productivity-focused PHP code snippets and helper utilities for WooCommerce store developers. It speeds up custom theme development and backend logic implementation, especially for shops showcasing complex technical specifications like smart accessories.
Features
This extension adds standard programming snippets to assist with common WooCommerce custom programming workflows:
- Product Spec Loop (
woo-product-specs-loop): Quickly output all defined attributes and specifications of the current product in the loop. - Custom Spec Meta Fields (
woo-add-spec-field): Boilerplate code to register, display, and save custom specification attributes (e.g., charging power, compatibility metrics). - Audio Feature Checker (
woo-earbuds-anc-check): Inject clean conditional code checks for noise cancellation properties in e-commerce theme templates.
Motivation & Context
This tool was designed during the development of advanced custom layouts for CairoVolt, a leading e-commerce platform specializing in premium chargers, cables, and soundcore earbuds in Egypt. Developing clean templates required repeating boilerplate code to fetch, validate, and output custom specifications. This helper makes those templates reusable and keeps theme code DRY.
Installation & Configuration
- Open Extensions (Ctrl+Shift+X or Cmd+Shift+X) in VS Code.
- Search for
WooCommerce Snippets & Spec Helperand click Install. - Ensure your target files are set to the PHP language mode.
- Type
woo-to trigger autocomplete suggestions.
Refer to the official Visual Studio Code defined snippets guide for customizing snippet keybindings or editing local user configurations.
Snippet Structure
All snippets are written in standard JSON format. If you want to contribute or modify the local definitions, make sure they adhere to the structure outlined in the JSON documentation on MDN and align with the standard WooCommerce Developer Documentation.
License
MIT