Metal Prices Management — Bangladesh Jewellery Commerce
A modern, standalone WooCommerce extension tailored specifically for the Bangladesh Jewellery Industry. It provides full compliance with Bangladesh Jewellers Association (BAJUS).
by Shubash Kumar Biswas & Antigravity Luxury Team · github.com/shubashbiswas/jewellery-prices-management · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/shubashbiswas/jewellery-prices-management/archive/refs/heads/main.zipMetal Prices Management — Bangladesh Jewellery Commerce for WooCommerce
A modern, standalone WooCommerce extension tailored specifically for the Bangladesh Jewellery Industry. It provides full compliance with Bangladesh Jewellers Association (BAJUS) market pricing standards, traditional weight systems (Bhori, Ana, Rotti, Point), customizable artisanal making charges (কারিগর মজুরি), and government VAT (NBR ৫%) transparency.
📋 Requirements
- WordPress: 7.0+
- PHP: 8.3+
- WooCommerce: 10.0+ (Tested up to 11.1)
🌟 Key Features
-
BAJUS Live Market Rates:
- Live rates for 22K (ক্যাডমিয়াম), 21K, 18K, Traditional Gold (সনাতন স্বর্ণ), Silver 925 (রূপা), and Platinum 950.
- Interactive two-way real-time converter: enter price per Bhori (ভরি) or per Gram (গ্রাম), and the other automatically syncs ($1\text{ Bhori} = 11.664\text{ Grams}$).
- Official BAJUS circular date and reference tracking.
-
Traditional Bengali Weight System:
- Built-in live calculator for ভরি (Bhori) – আনা (Ana) – রতি (Rotti) – পয়েন্ট (Point) converting instantly into decimal grams.
- Separate tracking for Net Metal Weight, Gross Weight, and Gemstone/Diamond Weight.
-
Dynamic WooCommerce Pricing Engine:
- Automatically recalculates product catalog prices and variation prices in real time when market gold rates fluctuate.
- Formula: $$\text{Final Price} = (\text{Net Gold Weight} \times \text{Live Karat Rate}) + \text{Making Charge} + \text{Stone Value} + 5\%\text{ VAT}$$
-
Flexible Making Charges (কারিগর মজুরি):
- Global defaults: Percentage of metal value (%), Fixed per Gram (৳/gm), or Fixed per Bhori (৳/ভরি).
- Per-product custom making charge overrides for intricate artisanal masterpieces.
-
NBR 5% Government VAT Compliance:
- Configurable VAT percentage (default 5% per Bangladesh National Board of Revenue regulations).
- Supports both VAT Inclusive and VAT Exclusive pricing display models.
-
Historical Order Rate Protection:
- Freezes and snapshots the exact gold rate, metal purity, net weight, making charge, and VAT amount onto the customer's order line items at checkout.
- Subsequent market price changes will never corrupt historical invoices or sales records.
-
Universal Standalone Compatibility:
- Works out of the box with any WooCommerce theme (Astra, Flatsome, Storefront, WoodMart, Kadence, Hello Elementor).
- Automatically hooks into
woocommerce_single_product_summaryor can be placed anywhere using shortcodes. - Supports template overrides in your theme (
your-theme/metal-prices/).
📁 Directory Structure
wp-content/plugins/metal-prices/
├── metal-prices.php # Plugin bootstrap: constants, loader, and global API
├── README.md # Comprehensive developer documentation
├── readme.txt # WordPress.org standard plugin readme
│
├── includes/ # Modular Core Logic
│ ├── class-metal-prices.php # Main orchestrator singleton
│ ├── class-bajus-rates.php # BAJUS rates, conversions & options manager
│ ├── class-pricing-engine.php # Dynamic pricing calculation & WooCommerce filters
│ ├── class-product-meta.php # Product Data tab (স্বর্ণের পরিমাপ) & weight calculator
│ ├── class-order-manager.php # Checkout line-item rate snapshotting
│ ├── class-shortcodes.php # Shortcode handlers
│ └── class-admin-settings.php # Admin dashboard, settings API, and live inputs
│
├── assets/ # Stylesheets and Scripts
│ ├── css/
│ │ ├── admin.css # Admin dashboard and product panel styles
│ │ └── frontend.css # Price breakdown card & rates widget styles
│ └── js/
│ └── admin.js # Real-time Bhori/Gram sync & Bangla weight converter
│
├── templates/ # Overridable Frontend Templates
│ ├── single-product-breakdown.php # Price transparency breakdown card
│ └── bajus-rates-widget.php # Live BAJUS rates table widget
│
└── languages/ # Localization
└── metal-prices.pot # Gettext translation catalog (English & Bengali)
🚀 Installation
- Upload the
metal-pricesfolder to your WordPress plugins directory (wp-content/plugins/). - Activate the plugin via WP Admin > Plugins.
- Navigate to WP Admin > Metal Prices (স্বর্ণের দর) to configure the daily BAJUS gold rates, making charges, and VAT preferences.
- Edit any WooCommerce product, go to the স্বর্ণের পরিমাপ (Jewellery Specs) tab, set the purity and net gold weight (using the built-in Bhori-Ana-Rotti calculator if needed), and publish!
💻 Developer API & Helpers
Modern PHP 8.3 Class Methods
Metal_Prices_BAJUS_Rates::get_all_rates(): array
Returns an associative array of all configured rates in both grams and bhori:
$rates = Metal_Prices_BAJUS_Rates::get_all_rates();
echo $rates['gold_22k_bhori']; // e.g. 237362
echo $rates['gold_22k_gm']; // e.g. 20350
Metal_Prices_Pricing_Engine::compute_product_pricing( WC_Product $product ): array|false
Computes the dynamic price breakdown for any WC_Product object:
$product = wc_get_product( 55 );
$pricing = Metal_Prices_Pricing_Engine::compute_product_pricing( $product );
/*
Returns:
[
'purity' => '22K',
'metal_type' => 'Gold',
'net_weight' => 26.8,
'rate_per_gram' => 20350,
'rate_per_bhori' => 237362,
'metal_value' => 545380,
'making_charge' => 65446,
'stone_value' => 0,
'vat_rate' => 5,
'vat_amount' => 30541,
'total_price' => 610826
]
*/
Metal_Prices_Pricing_Engine::render_breakdown_html( ?WC_Product $product = null ): string
Renders the price breakdown HTML card for a product.
🏷️ Shortcodes
1. [jewellery_price_breakdown]
Renders the complete price transparency breakdown card for the current product on single product pages.
- Attributes:
id(optional): Specific WooCommerce product ID (e.g.[jewellery_price_breakdown id="45"]).
2. [bajus_gold_rates]
Displays the official BAJUS gold rate table widget anywhere on your website (pages, posts, Elementor, Gutenberg, or footer widgets).
🎨 Template Overrides
To customize the frontend markup without losing changes on plugin updates, copy templates from metal-prices/templates/ to your active theme:
| Source Template | Theme Destination |
|---|---|
templates/single-product-breakdown.php |
your-theme/metal-prices/single-product-breakdown.php |
templates/bajus-rates-widget.php |
your-theme/metal-prices/bajus-rates-widget.php |
📄 License
This project is open-source and released under the GNU General Public License v2 or later.